]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[2.7] bpo-38216, bpo-36274: Allow subclasses to separately override validation and...
authorJason R. Coombs <jaraco@jaraco.com>
Tue, 8 Oct 2019 02:00:02 +0000 (22:00 -0400)
committerBenjamin Peterson <benjamin@python.org>
Tue, 8 Oct 2019 02:00:01 +0000 (19:00 -0700)
commitf5b1abbb3b0083381925dcd5898ae6d019224826
tree5904212a9769509dbdd2f86d184e02d5bdbf1091
parente7e58fe03175adc660c192e724b91ae7ccba9cb6
[2.7] bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior (GH-16476)

Backporting this change, I observe a couple of things:

1. The _encode_request call is no longer meaningful because the request construction will implicitly encode the request using the default encoding when the format string is used (request = '%s %s %s'...). In order to keep the code as consistent as possible, I decided to include the call as a pass-through. I'd be just as happy to remove it entirely, but I'll leave that up to the reviewer to decide. It's okay that this functionality is disabled on Python 2 because this functionality was mainly around bpo-36274, which was mainly a concern with the transition to Python 3.
2. Because _encode_request is no longer meaningful, neither is the test for it, so I've removed that test. Therefore, the meaningful part of this test is that for bpo-38216, adding a (underscore-protected) hook to customize/disable validation.

(cherry picked from commit 7774d7831e8809795c64ce27f7df52674581d298)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Lib/httplib.py
Lib/test/test_httplib.py
Misc/NEWS.d/next/Library/2019-09-27-15-24-45.bpo-38216.-7yvZR.rst [new file with mode: 0644]