[Python-Dev] site triggering a bug in urllib2

Thomas Mangin thomas.mangin at exa-networks.co.uk
Tue Jan 17 16:07:27 CET 2006


I am contacting the list in the hope that someone will be able to understand 
what I am seeing.

I have hit a bug with python 2.4.2 (on Mandriva 2006) using urllib2.
The code which trigger the bug is as follow..

import urllib2
req = urllib2.Request("")

# makes no difference ..
req.add_header('Connection', 'close')

handle = urllib2.urlopen(req)
data = handle.read()
print data

using a timeout on the socket does not work neither.

The page is well sent and received (verified with tcpdump) but the read call is 
never returning. strace shows lots of activity on the socket: select constantly 
returning a file descriptor with nothing to read on.

I would like to avoid to start to use timers to kill the connection manually, 
any advise on how to deal with this would be welcome.

Thank you for your time and help.

Exa Networks Limited - UK - AS30740 - www.exa-networks.co.uk
nic-handle : MANG-RIPE   website  : thomas.mangin.me.uk
GPG key ID : 0xFB8B81A1  PGP key  : /pgp.html
Inoc-DBA # : 30740*TOM   Office # : +44 (0) 845 145 1234
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/python-dev/attachments/20060117/d513da05/attachment-0001.pgp 

More information about the Python-Dev mailing list