[issue16830] Add skip_host and skip_accept_encoding to HTTPConnection.request()

2020-11-08 Thread Bryan Bishop


Bryan Bishop  added the comment:

I'll go ahead and close this. The putrequest/putheader/endheaders suggestion is 
probably sufficient. Although I do wonder if a docs update is warranted, 
explaining the default behavior..

--
resolution:  -> wont fix
stage:  -> resolved
status: pending -> closed

___
Python tracker 
<https://bugs.python.org/issue16830>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16830] Add skip_host and skip_accept_encoding to httplib/http.client

2012-12-31 Thread Bryan Bishop

New submission from Bryan Bishop:

Sometimes I am using httplib/http.client and the server is not exactly 
conforming to HTTP specs. I need to be able to specify the exact headers that 
are sent to the server. By default, httplib/http.client injects headers like 
"Host" and "Accept-Encoding".

Issue #831747 added skip_accept_encoding to httplib's putrequest method, but 
not on the request method. This current patch exposes these two toggles on the 
request method. This way, headers can be controlled without manually calling 
the connect/send/endheaders methods.

As a result, urllib/urllib3 can call urlopen and pass in these attributes to 
more directly control the headers sent to the remote server.

--
components: Library (Lib)
files: httplib_better_header_skips.patch
keywords: patch
messages: 178719
nosy: kanzure
priority: normal
severity: normal
status: open
title: Add skip_host and skip_accept_encoding to httplib/http.client
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file28516/httplib_better_header_skips.patch

___
Python tracker 
<http://bugs.python.org/issue16830>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16830] Add skip_host and skip_accept_encoding to httplib/http.client

2013-01-01 Thread Bryan Bishop

Bryan Bishop added the comment:

On Tue, Jan 1, 2013 at 5:41 AM, Antoine Pitrou wrote:
> Another possibility would be to allow passing None in values of the `headers` 
> dict, in which case the given header wouldn't be send at all.

I agree that your solution is more scaling-friendly than the patch I originally 
submitted. But from another perspective, consider how alien it is to have to 
explicitly add keys set to None in the headers to get desired behavior.

Maybe there could be a single flag "strict" (or possibly a better name) that 
would indicate that the dict is in fact what I want to send and that it should 
not be modified? Or perhaps there should be "base_headers" list (not a 
dictionary) of header keys of which defaults to not inject?

Also, would making {"Accept-Encoding": None} send no "Accept-Encoding" header 
be backwards incompatible with the current behavior?

--

___
Python tracker 
<http://bugs.python.org/issue16830>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com