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.

classification
Title: attempting to use urllib2 on some URLs fails starting on 2.4
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: out of date
Dependencies: Superseder: catch invalid chunk length in httplib read routine
View: 900744
Assigned To: Nosy List: calvin, jjlee, ssokolow
Priority: normal Keywords:

Created on 2005-02-16 06:06 by ssokolow, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg60654 - (view) Author: Stephan Sokolow (ssokolow) Date: 2005-02-16 06:06
The following will work correctly on Python 2.3.3 but fails 
on Python 2.4 
 
Python 2.4 (#1, Dec  4 2004, 01:33:42) 
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2 
Type "help", "copyright", "credits" or "license" for more 
information. 
>>> import urllib2 
>>> 
urllib2.urlopen('http://www.fanfiction.net/s/636805/10/').read() 
Traceback (most recent call last): 
  File "<stdin>", line 1, in ? 
  File "/usr/local/lib/python2.4/socket.py", line 285, in read 
    data = self._sock.recv(recv_size) 
  File "/usr/local/lib/python2.4/httplib.py", line 456, in read 
    return self._read_chunked(amt) 
  File "/usr/local/lib/python2.4/httplib.py", line 495, in 
_read_chunked 
    chunk_left = int(line, 16) 
ValueError: invalid literal for int(): 
msg60655 - (view) Author: Bastian Kleineidam (calvin) Date: 2005-02-16 16:38
Logged In: YES 
user_id=9205

This bug is in httplib.py, and I already submitted patch
900744. I wonder why on Python 2.3 it seems to work though,
it should fail the same way since this bug is also present
in Python 2.3. But it might be some change in urllib2 that
triggers this in Python 2.4 and not in Python 2.3.
msg60656 - (view) Author: John J Lee (jjlee) Date: 2006-02-01 20:38
Logged In: YES 
user_id=261020

I can't reproduce this.

1. On what OS did you observe the failure?

2. Anybody have another example that does still trigger the bug?
msg60657 - (view) Author: Bastian Kleineidam (calvin) Date: 2006-02-01 22:18
Logged In: YES 
user_id=9205

I added a testcase mockup attachment at patch #900744:

https://sourceforge.net/support/tracker.php?aid=900744

To reproduce with urllib2, start server.py and then execute:

import urllib2
urllib2.urlopen("http://localhost:8000/").read()
msg60658 - (view) Author: Stephan Sokolow (ssokolow) Date: 2006-02-02 12:10
Logged In: YES 
user_id=302370

For the record, I observed the problem on Gentoo Linux.
msg76750 - (view) Author: John J Lee (jjlee) Date: 2008-12-02 14:59
Can somebody close this?  It's fixed on trunk in #900744 .
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41583
2008-12-02 16:10:49amaury.forgeotdarcsetstatus: open -> closed
resolution: out of date
superseder: catch invalid chunk length in httplib read routine
2008-12-02 14:59:29jjleesetmessages: + msg76750
2005-02-16 06:06:50ssokolowcreate