This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author niallo
Recipients niallo
Date 2008-04-16.18:15:57
SpamBayes Score 0.021769393
Marked as misclassified No
Message-id <1208369760.69.0.00152295436269.issue2645@psf.upfronthosting.co.za>
In-reply-to
Content
I do a lot of urllib2 reads of HTTP URLs.  From time to time, I see the
following exception being thrown:

  File "/usr/local/lib/python2.5/socket.py", line 291, in read
    data = self._sock.recv(recv_size)
  File "/usr/local/lib/python2.5/httplib.py", line 509, in read
    return self._read_chunked(amt)
  File "/usr/local/lib/python2.5/httplib.py", line 548, in _read_chunked
    chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: ''

The chunked reading code does not expect an empty string.  I have
attached a patch which checks for ValueError in this case and sets
chunk_left to 0, which will break from the loop.  I am not entirely sure
if this is the correct fix, however, but it should illustrate the problem.
History
Date User Action Args
2008-04-16 18:16:01niallosetspambayes_score: 0.0217694 -> 0.021769393
recipients: + niallo
2008-04-16 18:16:00niallosetspambayes_score: 0.0217694 -> 0.0217694
messageid: <1208369760.69.0.00152295436269.issue2645@psf.upfronthosting.co.za>
2008-04-16 18:15:59niallolinkissue2645 messages
2008-04-16 18:15:58niallocreate