@@ -868,7 +868,7 @@ def _get_content_length(body, method):
868868 return None
869869
870870 def __init__ (self , host , port = None , timeout = socket ._GLOBAL_DEFAULT_TIMEOUT ,
871- source_address = None , blocksize = 8192 , max_headers = None ):
871+ source_address = None , blocksize = 8192 , max_response_headers = None ):
872872 self .timeout = timeout
873873 self .source_address = source_address
874874 self .blocksize = blocksize
@@ -881,9 +881,7 @@ def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
881881 self ._tunnel_port = None
882882 self ._tunnel_headers = {}
883883 self ._raw_proxy_headers = None
884- if max_headers is None :
885- max_headers = _MAXHEADERS
886- self .max_headers = max_headers
884+ self .max_response_headers = max_response_headers
887885
888886 (self .host , self .port ) = self ._get_hostport (host , port )
889887
@@ -976,7 +974,7 @@ def _tunnel(self):
976974 try :
977975 (version , code , message ) = response ._read_status ()
978976
979- self ._raw_proxy_headers = _read_headers (response .fp , max_headers = self .max_headers )
977+ self ._raw_proxy_headers = _read_headers (response .fp , self .max_response_headers )
980978
981979 if self .debuglevel > 0 :
982980 for header in self ._raw_proxy_headers :
@@ -1433,7 +1431,10 @@ def getresponse(self):
14331431
14341432 try :
14351433 try :
1436- response .begin (_max_headers = self .max_headers )
1434+ if self .max_response_headers is None :
1435+ response .begin ()
1436+ else :
1437+ response .begin (self .max_response_headers )
14371438 except ConnectionError :
14381439 self .close ()
14391440 raise
@@ -1465,11 +1466,11 @@ class HTTPSConnection(HTTPConnection):
14651466 def __init__ (self , host , port = None ,
14661467 * , timeout = socket ._GLOBAL_DEFAULT_TIMEOUT ,
14671468 source_address = None , context = None , blocksize = 8192 ,
1468- max_headers = None ):
1469+ max_response_headers = None ):
14691470 super (HTTPSConnection , self ).__init__ (host , port , timeout ,
14701471 source_address ,
14711472 blocksize = blocksize ,
1472- max_headers = max_headers )
1473+ max_response_headers = max_response_headers )
14731474 if context is None :
14741475 context = _create_https_context (self ._http_vsn )
14751476 self ._context = context
0 commit comments