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 pitrou
Recipients SilentGhost, orsenthil, pitrou, xhresko
Date 2010-11-29.17:51:19
SpamBayes Score 2.5357547e-05
Marked as misclassified No
Message-id <1291053095.5.0.677648990799.issue10577@psf.upfronthosting.co.za>
In-reply-to
Content
I can reproduce the issue with 3.2 here. Using Wireshark, I see that the request to http://www.ihnez.cz is satisfied, but the second request (to http://ihnez.cz) is never issued. Here is the Wireshark dump for the TCP session (request, then response):

"""GET / HTTP/1.1

Accept-Encoding: identity

Host: www.ihned.cz

User-Agent: Python-urllib/3.2



HTTP/1.1 302 Found

Server: nginx

Date: Mon, 29 Nov 2010 17:41:23 GMT

Content-Type: text/html; charset=WINDOWS-1250

Transfer-Encoding: chunked

Connection: keep-alive

Location: http://ihned.cz/



0

"""



Looking at the traceback when pressing Control-C, it seems the redirect handler in urllib expects the socket to be closed by the server, but it isn't; so it keeps waiting for more data (despite the "0" signifying the end of the chunked response):

>>> import urllib.request
>>> opener = urllib.request.FancyURLopener()
>>> f = opener.open("http://www.ihned.cz/")
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/antoine/py3k/__svn__/Lib/urllib/request.py", line 1504, in open
    return getattr(self, name)(url)
  File "/home/antoine/py3k/__svn__/Lib/urllib/request.py", line 1676, in open_http
    return self._open_generic_http(http.client.HTTPConnection, url, data)
  File "/home/antoine/py3k/__svn__/Lib/urllib/request.py", line 1672, in _open_generic_http
    response.status, response.reason, response.msg, data)
  File "/home/antoine/py3k/__svn__/Lib/urllib/request.py", line 1688, in http_error
    result = method(url, fp, errcode, errmsg, headers)
  File "/home/antoine/py3k/__svn__/Lib/urllib/request.py", line 1876, in http_error_302
    data)
  File "/home/antoine/py3k/__svn__/Lib/urllib/request.py", line 1887, in redirect_internal
    void = fp.read()
  File "/home/antoine/py3k/__svn__/Lib/socket.py", line 267, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt


However, urllib.request.urlopen() works fine in this case, so perhaps this advocates for deprecating the old stuff? Senthil?
History
Date User Action Args
2010-11-29 17:51:35pitrousetrecipients: + pitrou, orsenthil, SilentGhost, xhresko
2010-11-29 17:51:35pitrousetmessageid: <1291053095.5.0.677648990799.issue10577@psf.upfronthosting.co.za>
2010-11-29 17:51:19pitroulinkissue10577 messages
2010-11-29 17:51:19pitroucreate