mirror of
https://github.com/python/cpython.git
synced 2025-10-28 20:25:04 +00:00
The docs for httplib.HTTPConnection.putheader() have claimed for quite a while
that their could be an arbitrary number of values passed in. Turns out the code did not match that. The code now matches the docs.
This commit is contained in:
parent
031f3fb69a
commit
e3d0bf740f
2 changed files with 6 additions and 6 deletions
|
|
@ -846,7 +846,7 @@ def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
|
|||
# For HTTP/1.0, the server will assume "not chunked"
|
||||
pass
|
||||
|
||||
def putheader(self, header, value):
|
||||
def putheader(self, header, *values):
|
||||
"""Send a request header line to the server.
|
||||
|
||||
For example: h.putheader('Accept', 'text/html')
|
||||
|
|
@ -854,7 +854,7 @@ def putheader(self, header, value):
|
|||
if self.__state != _CS_REQ_STARTED:
|
||||
raise CannotSendHeader()
|
||||
|
||||
str = '%s: %s' % (header, value)
|
||||
str = '%s: %s' % (header, '\r\n\t'.join(values))
|
||||
self._output(str)
|
||||
|
||||
def endheaders(self):
|
||||
|
|
@ -989,6 +989,7 @@ def _setup(self, conn):
|
|||
# set up delegation to flesh out interface
|
||||
self.send = conn.send
|
||||
self.putrequest = conn.putrequest
|
||||
self.putheader = conn.putheader
|
||||
self.endheaders = conn.endheaders
|
||||
self.set_debuglevel = conn.set_debuglevel
|
||||
|
||||
|
|
@ -1008,10 +1009,6 @@ def getfile(self):
|
|||
"Provide a getfile, since the superclass' does not use this concept."
|
||||
return self.file
|
||||
|
||||
def putheader(self, header, *values):
|
||||
"The superclass allows only one value argument."
|
||||
self._conn.putheader(header, '\r\n\t'.join(values))
|
||||
|
||||
def getreply(self):
|
||||
"""Compat definition since superclass does not define it.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue