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
httplib: could not skip "ACCEPT-ENCODING" header #73665
Comments
When I tried to skip "ACCEPT-ENCODING" of header, I found the behavior was not right. def _send_request(self, method, url, body, headers):
# Honor explicitly requested Host: and Accept-Encoding: headers.
header_names = dict.fromkeys([k.lower() for k in headers])
skips = {}
if 'host' in header_names:
skips['skip_host'] = 1
if 'accept-encoding' in header_names:
skips['skip_accept_encoding'] = 1 |
Please explain what the wrong behaviour that you see is, and what you expect the right behaviour should be. That code is intended to either keep any user-supplied Accept-Encoding header field, or send “Accept-Encoding: identity” if the field is not supplied. If you are looking for a way to avoid adding this field entirely, see the lower level putrequest() and related methods. This is documented behaviour: <https://docs.python.org/2.7/library/httplib.html#httplib.HTTPConnection.putrequest\>. |
Sorry, I thought I misunderstood the meaning. I want no "ACCEPT-ENCODING" even "ACCEPT-ENCODING: identity". The http request will be no "ACCEPT-ENCODING". |
As Martin has stated, this can be achieved with putrequest as explained in the doc: https://docs.python.org/3.10/library/http.client.html#http.client.HTTPConnection.putrequest |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: