tom kel <tomke...@gmail.com> added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13651> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com