summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-08-02 12:01:21 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-08-02 12:01:21 (GMT)
commit3357840bafd2b118d19d0319cd9183a11cb4cd6b (patch)
tree7262ae7b01a6fff1a522df55babdfd1dbba9035e /Lib/http
parentfc499bcfd3c0d974ecbf9df2dd5017ed81bfae0b (diff)
downloadcpython-3357840bafd2b118d19d0319cd9183a11cb4cd6b.zip
cpython-3357840bafd2b118d19d0319cd9183a11cb4cd6b.tar.gz
cpython-3357840bafd2b118d19d0319cd9183a11cb4cd6b.tar.bz2
Merged revisions 83521 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83521 | senthil.kumaran | 2010-08-02 16:34:58 +0530 (Mon, 02 Aug 2010) | 3 lines Fix Issue8572 - httplib getheader() throws error instead of default ........
Diffstat (limited to 'Lib/http')
-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 612fa37..d490b3d 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."""