[New-bugs-announce] [issue13696] [urllib.request.HTTPRedirectHandler.http_error_302] Relative Redirect issue

CRicky report at bugs.python.org
Mon Jan 2 19:40:30 CET 2012

New submission from CRicky <cricky.kmp at gmx.fr>:

I had an HTTP redirection that worked perfectly on version 3.1.

On version 3.2, I get a HTTP error 302. In this redirection, I actually have 2 redirections. The last one does not work because it is a relative redirection, so urlparts.scheme is empty.

Some lines have been added in version 3.2 for security reason, but it also blocks relative links in 302 return.

To correct, I have added empty scheme in check:
        if not urlparts.scheme in ('http', 'https', 'ftp', ''):

With that, it works correctly.
I don't make you any for 3 new chars. ;)

Best regards,

components: Library (Lib)
messages: 150473
nosy: CRicky
priority: normal
severity: normal
status: open
title: [urllib.request.HTTPRedirectHandler.http_error_302] Relative Redirect issue
type: behavior
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list