eshad / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

httplib2 produces IndexError with email/header.py module #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to use an HttpPool with lots of httplib2.Http() instances, in order 
to batch download a URL list.

I came across this exception, in the middle of downloads, and even simple HEAD 
requests (I am checking for hostnames if they are responsive or if they will 
return httplib2.ServerNotFoundError)

Here is the traceback:
...
  File "/usr/local/lib/python3.2/dist-packages/httplib2/__init__.py", line 1175, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/local/lib/python3.2/dist-packages/httplib2/__init__.py", line 987, in _request
    _updateCache(headers, response, content, self.cache, cachekey)
  File "/usr/local/lib/python3.2/dist-packages/httplib2/__init__.py", line 386, in _updateCache
    header_str = info.as_string()
  File "/usr/lib/python3.2/email/message.py", line 167, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python3.2/email/generator.py", line 88, in flatten
    self._write(msg)
  File "/usr/lib/python3.2/email/generator.py", line 141, in _write
    self._write_headers(msg)
  File "/usr/lib/python3.2/email/generator.py", line 176, in _write_headers
    self.write(header.encode(linesep=self._NL)+self._NL)
  File "/usr/lib/python3.2/email/header.py", line 317, in encode
    formatter.feed(lines[0], charset)
IndexError: list index out of range

I am on Ubuntu 11.04 and using Python 3.2, please tell me if you need any other 
information on this issue.

Original issue reported on code.google.com by ke...@ulutas.gen.tr on 19 Aug 2011 at 6:11