summaryrefslogtreecommitdiffstats
path: root/Lib/http/client.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-08-02 11:04:58 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-08-02 11:04:58 (GMT)
commit9f8dc4441fa1f053a150abedd3dfb99f671a75b9 (patch)
treebbc3cb0a9887513a3f916107b1becdcbb1cef895 /Lib/http/client.py
parentaed05eb6b84456f8a97382f65a2d38779249b4a2 (diff)
downloadcpython-9f8dc4441fa1f053a150abedd3dfb99f671a75b9.zip
cpython-9f8dc4441fa1f053a150abedd3dfb99f671a75b9.tar.gz
cpython-9f8dc4441fa1f053a150abedd3dfb99f671a75b9.tar.bz2
Fix Issue8572 - httplib getheader() throws error instead of default
Diffstat (limited to 'Lib/http/client.py')
-rw-r--r--Lib/http/client.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index e4a9c07..d1d2bb9 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -602,7 +602,11 @@ class HTTPResponse(io.RawIOBase):
def getheader(self, name, default=None):
if self.headers is None:
raise ResponseNotReady()
- return ', '.join(self.headers.get_all(name, default))
+ headers = self.headers.get_all(name) or default
+ if isinstance(headers, str) or not hasattr(headers, '__iter__'):
+ return headers
+ else:
+ return ', '.join(headers)
def getheaders(self):
"""Return list of (header, value) tuples."""