diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-02-14 00:30:58 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-02-14 12:06:28 +0100 |
commit | 9082a1fc7be02f58cbe18a34539c6a3436463dd0 (patch) | |
tree | e8cd4ceb678ef43e7be031c835f6ee7866052e8b /methods | |
parent | f9b4f12d65b827612b29071f05d605bc05fa62bd (diff) |
allow http protocol to switch to https
switch protocols at random is a bad idea if e.g. http can switch to
file, so we limit the possibilities to http to http and http to https.
As very few people (less than 1% according to popcon) have https
installed this likely changes nothing in terms of failure. The commit is
adding a friendly hint which package needs to be installed though.
Diffstat (limited to 'methods')
-rw-r--r-- | methods/server.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/methods/server.cc b/methods/server.cc index 76faa7e7f..6dd3970a6 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -291,11 +291,15 @@ ServerMethod::DealWithHeaders(FetchResult &Res) } else { - NextURI = DeQuoteString(Server->Location); - URI tmpURI = NextURI; - // Do not allow a redirection to switch protocol - if (tmpURI.Access == "http") - return TRY_AGAIN_OR_REDIRECT; + NextURI = DeQuoteString(Server->Location); + URI tmpURI = NextURI; + URI Uri = Queue->Uri; + // same protocol redirects are okay + if (tmpURI.Access == Uri.Access) + return TRY_AGAIN_OR_REDIRECT; + // as well as http to https + else if (Uri.Access == "http" && tmpURI.Access == "https") + return TRY_AGAIN_OR_REDIRECT; } /* else pass through for error message */ } |