Kaydet (Commit) e3d0bf74 authored tarafından Brett Cannon's avatar Brett Cannon

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.
üst 031f3fb6
...@@ -846,7 +846,7 @@ class HTTPConnection: ...@@ -846,7 +846,7 @@ class HTTPConnection:
# For HTTP/1.0, the server will assume "not chunked" # For HTTP/1.0, the server will assume "not chunked"
pass pass
def putheader(self, header, value): def putheader(self, header, *values):
"""Send a request header line to the server. """Send a request header line to the server.
For example: h.putheader('Accept', 'text/html') For example: h.putheader('Accept', 'text/html')
...@@ -854,7 +854,7 @@ class HTTPConnection: ...@@ -854,7 +854,7 @@ class HTTPConnection:
if self.__state != _CS_REQ_STARTED: if self.__state != _CS_REQ_STARTED:
raise CannotSendHeader() raise CannotSendHeader()
str = '%s: %s' % (header, value) str = '%s: %s' % (header, '\r\n\t'.join(values))
self._output(str) self._output(str)
def endheaders(self): def endheaders(self):
...@@ -989,6 +989,7 @@ class HTTP: ...@@ -989,6 +989,7 @@ class HTTP:
# set up delegation to flesh out interface # set up delegation to flesh out interface
self.send = conn.send self.send = conn.send
self.putrequest = conn.putrequest self.putrequest = conn.putrequest
self.putheader = conn.putheader
self.endheaders = conn.endheaders self.endheaders = conn.endheaders
self.set_debuglevel = conn.set_debuglevel self.set_debuglevel = conn.set_debuglevel
...@@ -1008,10 +1009,6 @@ class HTTP: ...@@ -1008,10 +1009,6 @@ class HTTP:
"Provide a getfile, since the superclass' does not use this concept." "Provide a getfile, since the superclass' does not use this concept."
return self.file 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): def getreply(self):
"""Compat definition since superclass does not define it. """Compat definition since superclass does not define it.
......
...@@ -38,6 +38,9 @@ Core and Builtins ...@@ -38,6 +38,9 @@ Core and Builtins
Library Library
------- -------
- httplib.HTTPConnection.putheader() now accepts an arbitrary number of values
for any header, matching what the documentation has claimed for a while.
- Issue #3774: Fixed an error when create a Tkinter menu item without command - Issue #3774: Fixed an error when create a Tkinter menu item without command
and then remove it. and then remove it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment