Mercurial > cpython-lru_cache-weakref
diff Lib/http/client.py @ 63537:39e14df765e4
Fix Issue8572 - httplib getheader() throws error instead of default
| author | Senthil Kumaran <orsenthil@gmail.com> |
|---|---|
| date | Mon, 02 Aug 2010 11:04:58 +0000 |
| parents | 5aa726414f8f |
| children | 7c0f1837e8cb |
line wrap: on
line diff
--- a/Lib/http/client.py Mon Aug 02 01:43:41 2010 +0000 +++ b/Lib/http/client.py Mon Aug 02 11:04:58 2010 +0000 @@ -602,7 +602,11 @@ 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."""
