-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Host header position causes certain sites to not respond #3265
Comments
I'm sorry but the server is not correct. We can change an order of request headers construction to put Host first but in general there is no guarantee to satisfy other weird servers requirements. |
Yes the server is incorrect, however this should be developed to replicate a browser as closely as possible. There are a few of sites that fall into this category, |
😮 |
The patch is pretty easy.
The PR is very appreciated. |
@asvetlov, I've created a PR with initial attempt at this. I have moved the How do I check / test the view / state of the headers as seen from the server perspective? Also I'm not sure what you meant by the third point. |
Regarding tests: please take a look on https://github.com/aio-libs/aiohttp/blob/master/tests/test_client_functional.py The third point is about |
Fixed by #3342 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Outbound requests add the
Host
header last instead of first which causes an issue fetching certain sites. Normally this shouldn't matter, however I'm coming across servers that won't respond unless it's defined first as it is in a browser.Example:
This is through a browser and successfully responds:
This is through aiohttp and does not respond (notice the Host header position):
To replicate this behavior use the the following code and notice it will time out.
Tested on:
Windows 7x64
Python 3.7.0
aiohttp 3.3.2
The text was updated successfully, but these errors were encountered: