Unclear http headers case handling in Protocols.HTTP.do_async_method()
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=7831
Reported by Tobias Liin liin@roxen.com
Protocols.HTTP.do_async_method()
provides default values for http headers "user-agent"
and "host"
, if not provided in the request_headers variable.
However, it fails to consider the casing of those headers. Consider a call to do_async_method()
with the following headers mapping:
([
"Host": "foo.com",
"User-Agent": "Firefox"
])
The mapping provided to Protocols.HTTP.Query.async_request()
will be:
([
"Host": "foo.com",
"User-Agent": "Firefox"
"host": "<some-host-from-the-url>",
"user-agent": "Pike <some-version>",
])
The resulting host and user-agent will be random, as Protocols.HTTP.Query.async_request()
lowercase the indices.
The solution is probably for Protocols.HTTP.do_async_method()
to lowercase the headers mapping indices before checking for "host"
and "user-agent"
.