Ensure redirected URL is Unicode encoded.

This commit is contained in:
Bastian Kleineidam 2010-03-07 22:11:55 +01:00
parent c8e6995ecd
commit b8b0398dd2
2 changed files with 3 additions and 1 deletions

View file

@ -9,6 +9,8 @@ Fixes:
Closes: SF bug #2901667
- http: Retry if server closed connection and sent an empty
status line. Fixes the "BadStatusLine" errors.
- http: Prevent UnicodeDecodeError on redirection by ensuring that
the redirected URL will be Unicode encoded.
- installer: Add commandline executable to Windows installer.
Closes: SF bug #2903257
- http: Warn about permanent redirections even when redirected URL is

View file

@ -313,8 +313,8 @@ Use URL `%(newurl)s' instead for checking.""") % {
newurl = self.headers.getheader("Location",
self.headers.getheader("Uri", ""))
# make new url absolute and unicode
newurl = urlparse.urljoin(redirected, newurl)
newurl = unicode_safe(newurl)
newurl = urlparse.urljoin(redirected, newurl)
log.debug(LOG_CHECK, "Redirected to %r", newurl)
self.add_info(_("Redirected to `%(url)s'.") % {'url': newurl})
# norm base url - can raise UnicodeError from url.idna_encode()