Do not print warning for HTTP to HTTPS or HTTPS to HTTP redirects.

This commit is contained in:
Bastian Kleineidam 2010-10-27 14:44:05 +02:00
parent b2cf40151f
commit 23403f09bb
4 changed files with 17 additions and 17 deletions

View file

@ -5,6 +5,8 @@ Fixes:
Changes:
- cmdline: Don't log a warning if URL has been redirected.
Closes: SF bug #3078820
- checking: Do not print warnings for HTTP -> HTTPS and HTTPS -> HTTP
redirects any more.
Features:

View file

@ -1,3 +1,6 @@
- [CHECKING] Check for duplicate URLs that are downloaded, which
should not happen: use a thread-safe cache with already-downloaded
URLs
- [GUI] Allow login URL to be configured.
- [GUI] Show detailed URL properties
- [GUI] Save options in qsettings or in external file (for each URL?).

View file

@ -376,18 +376,11 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
_("recursive redirection encountered:\n %(urls)s") %
{"urls": "\n => ".join(recursion)}, valid=False)
return -1, response
if urlparts[0] == self.scheme:
if urlparts[0] == self.scheme or urlparts[0] in ('http', 'https'):
# remember redireced url as alias
self.aliases.append(redirected)
# note: urlparts has to be a list
self.urlparts = urlparts
if set_result:
self.check301status(response)
# check cache again on the changed URL
if self.aggregate.urlqueue.checked_redirect(redirected, self):
return -1, response
# in case of changed scheme make new URL object
if self.urlparts[0] != self.scheme:
else:
# in case of changed scheme make new URL object
newobj = get_url_from(
redirected, self.recursion_level, self.aggregate,
parent_url=self.parent_url, base_ref=self.base_ref,
@ -398,10 +391,18 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
" found; the original URL was `%(url)s'.") %
{"url": self.url, "newurl": newobj.url},
tag=WARN_HTTP_WRONG_REDIRECT)
self.set_result(u"syntax OK")
# append new object to queue
self.aggregate.urlqueue.put(newobj)
# pretend to be finished and logged
return -1, response
# note: urlparts has to be a list
self.urlparts = urlparts
if set_result:
self.check301status(response)
# check cache again on the changed URL
if self.aggregate.urlqueue.checked_redirect(redirected, self):
return -1, response
# new response data
response.close()
response = self._try_http_response()

View file

@ -58,14 +58,8 @@ class TestHttp (HttpServerTest):
resultlines = [
u"url %s" % url,
u"cache key %s" % nurl,
u"real url %s" % rurl,
u"real url %s" % url,
u"info Redirected to `%s'." % rurl.replace('http:', 'https:'),
u"warning Redirection to different URL type encountered; the " \
u"original URL was `%s'." % url,
u"valid",
u"url %s" % rurl,
u"cache key %s" % rurl,
u"real url %s" % rurl,
u"error",
]
self.direct(url, resultlines, recursionlevel=0)