@@ -596,18 +596,21 @@ def _send_output(self):
596596 del self ._buffer [:]
597597 self .send (msg )
598598
599- def putrequest (self , method , url , skip_host = 0 ):
599+ def putrequest (self , method , url , skip_host = 0 , skip_accept_encoding = 0 ):
600600 """Send a request to the server.
601601
602602 `method' specifies an HTTP request method, e.g. 'GET'.
603603 `url' specifies the object being requested, e.g. '/index.html'.
604+ `skip_host' if True does not add automatically a 'Host:' header
605+ `skip_accept_encoding' if True does not add automatically an
606+ 'Accept-Encoding:' header
604607 """
605608
606609 # if a prior response has been completed, then forget about it.
607610 if self .__response and self .__response .isclosed ():
608611 self .__response = None
609612
610- #
613+
611614 # in certain cases, we cannot issue another request on this connection.
612615 # this occurs when:
613616 # 1) we are in the process of sending a request. (_CS_REQ_STARTED)
@@ -676,7 +679,8 @@ def putrequest(self, method, url, skip_host=0):
676679
677680 # we only want a Content-Encoding of "identity" since we don't
678681 # support encodings such as x-gzip or x-deflate.
679- self .putheader ('Accept-Encoding' , 'identity' )
682+ if not skip_accept_encoding :
683+ self .putheader ('Accept-Encoding' , 'identity' )
680684
681685 # we can accept "chunked" Transfer-Encodings, but no others
682686 # NOTE: no TE header implies *only* "chunked"
0 commit comments