Skip to content

Response headers dict is not case insensitive #129

Open
@Phuker

Description

@Phuker

Behavior of tls_client:

import tls_client

sess = tls_client.Session(
    client_identifier='chrome_120',
    random_tls_extension_order=True,
)
resp = sess.get('https://www.example.com/')

print(type(resp.headers)) # <class 'dict'>

print(resp.headers.get('Server')) # ECAcc (lac/55CB)
print(resp.headers['Server']) # ECAcc (lac/55CB)

print(resp.headers.get('sErVeR')) # None
print(resp.headers['sErVeR']) # KeyError: 'sErVeR'

This is behavior of requests as a contrast:

import requests

sess = requests.Session()
resp = sess.get('https://www.example.com/')

print(type(resp.headers)) # <class 'requests.structures.CaseInsensitiveDict'>

print(resp.headers.get('Server')) # ECAcc (lac/55D7)
print(resp.headers['Server']) # ECAcc (lac/55D7)

print(resp.headers.get('sErVeR')) # ECAcc (lac/55D7)
print(resp.headers['sErVeR']) # ECAcc (lac/55D7)

Version info:

  • tls_client version: 1.0.1
  • Python version: 3.12.6

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions