[New-bugs-announce] [issue4493] urllib2 doesn't always supply / where URI path component is empty
John J Lee
report at bugs.python.org
Tue Dec 2 21:46:12 CET 2008
New submission from John J Lee <jjlee at users.sourceforge.net>:
As required by RFC 2616 section 3.2.2, for all HTTP requests sent by
urllib2, the path component of the URI should be normalized to "/"
before the Request-URI derived from it gets passed to httplib (or
something functionally equivalent to that). This was fixed in one case
in #2464, but the fix is in the wrong place, since it's a general
problem not specific to redirects. See the longer discussion here:
http://bugs.python.org/msg76736
(hmm, let's see if I can just say msg76736 and get a hyperlink)
Example:
import urllib2
urllib2.urlopen("http://python.org?spam")
Expect: sends "/?spam" in request line.
Got: sends "?spam" in request line.
Probably should be fixed by making Request.get_selector() return the
normalized URI reference (with the slash always present). When fixing,
remember that the Request-URI of RFC 2616 (returned by .get_selector())
is sometimes a relative reference, and sometimes a URI (in RFC 3986's
terminology).
----------
messages: 76777
nosy: jjlee
severity: normal
status: open
title: urllib2 doesn't always supply / where URI path component is empty
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4493>
_______________________________________
More information about the New-bugs-announce
mailing list