Index: Doc/lib/libhttplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhttplib.tex,v retrieving revision 1.35 diff -u -r1.35 libhttplib.tex --- Doc/lib/libhttplib.tex 2 Sep 2003 02:32:54 -0000 1.35 +++ Doc/lib/libhttplib.tex 11 Nov 2003 16:58:16 -0000 @@ -174,11 +174,15 @@ \method{getreply()} has been called. \end{methoddesc} -\begin{methoddesc}{putrequest}{request, selector} +\begin{methoddesc}{putrequest}{request, selector\optional{, +skip\_host\optional{, skip_accept_encoding}}} This should be the first call after the connection to the server has been made. It sends a line to the server consisting of the \var{request} string, the \var{selector} string, and the HTTP version -(\code{HTTP/1.1}). +(\code{HTTP/1.1}). To disable automatic sending of \code{Host:} or +\code{Accept-Encoding:} headers (for example to accept additional +content encodings), specify \var{skip_host} or \var{skip_accept_encoding} +with non-False values. \end{methoddesc} \begin{methoddesc}{putheader}{header, argument\optional{, ...}} Index: Lib/httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.81 diff -u -r1.81 httplib.py --- Lib/httplib.py 9 Nov 2003 16:41:38 -0000 1.81 +++ Lib/httplib.py 11 Nov 2003 16:58:17 -0000 @@ -596,18 +596,21 @@ del self._buffer[:] self.send(msg) - def putrequest(self, method, url, skip_host=0): + def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): """Send a request to the server. `method' specifies an HTTP request method, e.g. 'GET'. `url' specifies the object being requested, e.g. '/index.html'. + `skip_host' if True does not add automatically a 'Host:' header + `skip_accept_encoding' if True does not add automatically an + 'Accept-Encoding:' header """ # if a prior response has been completed, then forget about it. if self.__response and self.__response.isclosed(): self.__response = None - # + # in certain cases, we cannot issue another request on this connection. # this occurs when: # 1) we are in the process of sending a request. (_CS_REQ_STARTED) @@ -676,7 +679,8 @@ # we only want a Content-Encoding of "identity" since we don't # support encodings such as x-gzip or x-deflate. - self.putheader('Accept-Encoding', 'identity') + if not skip_accept_encoding: + self.putheader('Accept-Encoding', 'identity') # we can accept "chunked" Transfer-Encodings, but no others # NOTE: no TE header implies *only* "chunked"