Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response headers dict is not case insensitive #129

Open
Phuker opened this issue Sep 25, 2024 · 0 comments
Open

Response headers dict is not case insensitive #129

Phuker opened this issue Sep 25, 2024 · 0 comments

Comments

@Phuker
Copy link

Phuker commented Sep 25, 2024

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!

rsb-23 added a commit to rsb-23/Python-Tls-Client that referenced this issue Nov 23, 2024
- added timeout alias
- Using case insensitive dict for headers
rsb-23 added a commit to rsb-23/tls-client that referenced this issue Nov 24, 2024
- Added requirements.txt
- Fixes issue FlorianREGAZ/Python-Tls-Client#129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant