homepage

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: Improve redirection in urllib
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: [urllib.request.HTTPRedirectHandler.http_error_302] Relative Redirect issue
View: 13696
Assigned To: Nosy List: brian.curtin, christian.heimes, orsenthil, tkel
Priority: normal Keywords: patch

Created on 2011年12月22日 18:09 by tkel, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
http-redirect-3.2.diff tkel, 2011年12月22日 18:09
2012年1月26日.diff tkel, 2012年01月27日 02:10
Messages (5)
msg150103 - (view) Author: Tommy Kelly (tkel) Date: 2011年12月22日 18:09
refer to patch for improvements
msg150104 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2011年12月22日 18:11
Can you explain the patch and state why you would like that change included?
This would require a test.
msg150105 - (view) Author: Tommy Kelly (tkel) Date: 2011年12月22日 18:41
I created this patch to further the functionality of redirection using the "location" header in the HTTPRedirectHandler class under urllib/request.py
Currently, the method http_error_302, which will handle code 302 redirection will parse the location header and build a Request accordingly. I encountered a website that only returned "index.php" as the Location header. When http_error_302 called on urlparse, it returned the following tuple: ParseResult(scheme='', netloc='', path='index.php', params='', query='', fragment='')
Then, http_error_302 will check if the scheme is equal to either http, https, or ftp. This is the part I changed in the patch. If it does not pass, an exception is thrown.
Afterwards, http_error_302 builds the target url. As long as the url passes the scheme check, the program will succeed.
msg152059 - (view) Author: Tommy Kelly (tkel) Date: 2012年01月27日 02:10
I changed the patch and made it a little bit better.
msg192375 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013年07月05日 23:28
New features have to go into 3.4
History
Date User Action Args
2022年04月11日 14:57:24adminsetgithub: 57860
2016年07月31日 03:38:24martin.pantersetstatus: open -> closed
superseder: [urllib.request.HTTPRedirectHandler.http_error_302] Relative Redirect issue
resolution: duplicate
stage: resolved
2014年01月31日 23:37:17yselivanovsetversions: + Python 3.5, - Python 3.4
2013年07月05日 23:28:41christian.heimessetnosy: + christian.heimes

messages: + msg192375
versions: - Python 3.1, Python 3.2, Python 3.3
2012年01月27日 02:10:39tkelsetfiles: + 2012年1月26日.diff

messages: + msg152059
versions: + Python 3.1, Python 3.4, - Python 2.7
2011年12月23日 14:51:49pitrousetnosy: + orsenthil

versions: + Python 2.7, - Python 3.4
2011年12月22日 18:41:26tkelsetmessages: + msg150105
2011年12月22日 18:11:37brian.curtinsetnosy: + brian.curtin
messages: + msg150104
2011年12月22日 18:09:38tkelcreate

AltStyle によって変換されたページ (->オリジナル) /