Malformed header causes IndexError during header parsing
See original GitHub issueThis response (note the space and quotes around Content-type
):
$ curl --head https://consumersentinel.gov
HTTP/1.0 200 OK
"Content-type": text/html
pragma: no-cache
retry-after: 600
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Server: BigIP
Connection: Keep-Alive
Content-Length: 2835
Causes this error in urllib3
:
File "/home/eric/.pyenv/versions/2.7.11/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 590, in urlopen
**response_kw)
File "/home/eric/.pyenv/versions/2.7.11/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 373, in from_httplib
headers = HTTPHeaderDict.from_httplib(headers)
File "/home/eric/.pyenv/versions/2.7.11/lib/python2.7/site-packages/requests/packages/urllib3/_collections.py", line 317, in from_httplib
key, value = headers[-1]
IndexError: list index out of range
I’m using urllib3
via requests
, but it doesn’t look like that’s causing the issue.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
malformed header from script 'index.php' bad header, despite ...
Try echo json_encode('hello') and see if that appears as a header in the log as well. It looks like your body is being...
Read more >BIP5000-5999: Runtime components - Parsers - IBM
A code page converter used for character conversion could not be initialized, possibly because an invalid code page was specified in the message...
Read more >Indexer errors and warnings - Azure Cognitive Search
This error occurs when the indexer is unable to finish processing a single document from the data source within the allowed execution time....
Read more >Changelog — aiohttp 3.7.3 documentation
Fixed a type error caused by the conditional import of Protocol . ... When parsing the Forwarded header, the optional port number is...
Read more >Issue 45001: Date parsing helpers in email module incorrectly ...
msg400261 ‑ (view) Author: wouter bolsterlee (wbolster) * Date: 2021‑08‑25 13:23
msg400262 ‑ (view) Author: wouter bolsterlee (wbolster) * Date: 2021‑08‑25 13:27
msg400351 ‑ (view)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What the hell is that monstrous header? Whomever is operating that web server needs a very stern telling off, because that output isn’t even close to acceptable.
Regardless, good debugging folks!
Actually, not a difference in the parsing - found the issue, and will have a PR shortly.