classification
Title: Http redirection error in urllib2.py
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dehn, georg.brandl, jjlee, vstinner
Priority: normal Keywords:

Created on 2005-11-10 20:25 by dehn, last changed 2019-04-10 09:13 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
urllib2.py dehn, 2005-11-10 20:25 Python library source file
Messages (4)
msg26836 - (view) Author: Thomas Dehn (dehn) Date: 2005-11-10 20:25
A url request returns a redirect that contains a space '  ' 
character. Python urllib2.py does not replace this 
character with '%20' and fails.

Entering a line after line 507 of:
            newurl=re.sub(' ','%20',newurl)
         
Corrects my problem.
msg26837 - (view) Author: John J Lee (jjlee) Date: 2006-02-01 20:28
Logged In: YES 
user_id=261020

The problem is more general, so perhaps:

URLQUOTE_SAFE_URL_CHARS = "!*'();:@&=+$,/?%#[]~"
newurl = urllib.quote(url, URLQUOTE_SAFE_URL_CHARS)


Caveat: I still haven't read RFCs 3986/3987...
msg26838 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-03-18 11:35
Logged In: YES 
user_id=849994

Added a fix in rev. 43132.
msg339838 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-10 09:13
> Added a fix in rev. 43132.

In Git, it became the commit:

commit ddb84d7c69addc5d5e2ab3e327260d97b52af3a7
Author: Georg Brandl <georg@python.org>
Date:   Sat Mar 18 11:35:18 2006 +0000

    Bug #1353433: be conciliant with spaces in redirect URLs
History
Date User Action Args
2019-04-10 09:13:08vstinnersetnosy: + vstinner
messages: + msg339838
2005-11-10 20:25:56dehncreate