summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2017-01-18 20:39:27 +0100
committerJulian Andres Klode <jak@debian.org>2017-01-24 11:48:22 +0100
commit4759a702081297bde66982efed8b2b7fd39ca27c (patch)
tree7d08902b71b6d06d22373f0281d8ebbdc407046f /methods
parent93cff633a830e222693fc0f3d78e6e534d1126ee (diff)
basehttp: Only read Content-Range on 416 and 206 responses
This fixes issues with sourceforge where the redirector includes such a Content-Range in a 302 redirect. Since we do not really know what file is meant in a redirect, let's just ignore it for all responses other than 416 and 206. Maybe we should also get rid of the other errors, and just ignore the field in those cases as well? LP: #1657567
Diffstat (limited to 'methods')
-rw-r--r--methods/basehttp.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index c88e62f46..d7d9bccd0 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -175,7 +175,11 @@ bool RequestState::HeaderLine(string const &Line) /*{{{*/
return true;
}
- if (stringcasecmp(Tag,"Content-Range:") == 0)
+ // The Content-Range field only has a meaning in HTTP/1.1 for the
+ // 206 (Partial Content) and 416 (Range Not Satisfiable) responses
+ // according to RFC7233 "Range Requests", ยง4.2, so only consider it
+ // for such responses.
+ if ((Result == 416 || Result == 206) && stringcasecmp(Tag,"Content-Range:") == 0)
{
HaveContent = true;