New submission from Niall O'Higgins <[EMAIL PROTECTED]>: 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. ---------- components: Library (Lib) files: httplib.py.diff keywords: patch messages: 65557 nosy: niallo severity: normal status: open title: httplib throws ValueError type: behavior versions: Python 2.5 Added file: http://bugs.python.org/file10040/httplib.py.diff __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2645> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com