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: Urllib2.urlopen() raises OSError w/bad HTTP Location header
Type: Stage:
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, jerry.seutter, nikitathespider
Priority: normal Keywords:

Created on 2006-11-07 03:08 by nikitathespider, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
PythonBug1591774.txt nikitathespider, 2006-11-07 03:20 Relevant URLs and code to reproduce
Messages (3)
msg30472 - (view) Author: nikitathespider (nikitathespider) Date: 2006-11-07 03:08
The documentation for urllib2.urlopen() says that it
"[r]aises URLError on errors". But if urllib2 requests
a resource from a (misconfigured) Web server and that
server returns 302 response with the Location header
set to "file:", urlopen raises "OSError: [Errno 2] No
such file or directory: ''". I have seen such a
misconfiguration in the wild; I've also created a URL
on my server that reproduces the problem in case the
real-world URL disappears or is fixed. Both URLs are in
the attachment with code to reproduce the problem.

I can recreate this under Python 2.3 - 2.5 under Mac OS
X, FreeBSD and Win2k.

I would be satisfied if the module simply followed the
documentation and actually returned URLError.
msg30473 - (view) Author: Jerry Seutter (jerry.seutter) * (Python committer) Date: 2007-02-24 23:23
Fix submitted in patch 1668100 - urllib2.urlopen() raises OSError instead of URLError

http://sourceforge.net/tracker/index.php?func=detail&aid=1668100&group_id=5470&atid=305470
msg30474 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-13 08:15
Fixed with said patch. Thanks for the report!
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44204
2006-11-07 03:08:02nikitathespidercreate