mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-99352: Respect http.client.HTTPConnection.debuglevel
in urllib.request.AbstractHTTPHandler
(#99353)
* bugfix: let the HTTP- and HTTPSHandlers respect the value of http.client.HTTPConnection.debuglevel * add tests * add news * ReSTify NEWS and reword a bit. * Address Review Comments. * Use mock.patch.object instead of settting the module level value. * Used test values to assert the debuglevel. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Senthil Kumaran <senthil@python.org>
This commit is contained in:
parent
4898415df7
commit
5c00a6224d
3 changed files with 57 additions and 18 deletions
|
@ -1251,8 +1251,8 @@ class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
|
|||
|
||||
class AbstractHTTPHandler(BaseHandler):
|
||||
|
||||
def __init__(self, debuglevel=0):
|
||||
self._debuglevel = debuglevel
|
||||
def __init__(self, debuglevel=None):
|
||||
self._debuglevel = debuglevel if debuglevel is not None else http.client.HTTPConnection.debuglevel
|
||||
|
||||
def set_http_debuglevel(self, level):
|
||||
self._debuglevel = level
|
||||
|
@ -1378,7 +1378,8 @@ if hasattr(http.client, 'HTTPSConnection'):
|
|||
|
||||
class HTTPSHandler(AbstractHTTPHandler):
|
||||
|
||||
def __init__(self, debuglevel=0, context=None, check_hostname=None):
|
||||
def __init__(self, debuglevel=None, context=None, check_hostname=None):
|
||||
debuglevel = debuglevel if debuglevel is not None else http.client.HTTPSConnection.debuglevel
|
||||
AbstractHTTPHandler.__init__(self, debuglevel)
|
||||
if context is None:
|
||||
http_version = http.client.HTTPSConnection._http_vsn
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue