diff options
author | Julian Andres Klode <jak@debian.org> | 2017-01-18 20:39:27 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2017-02-22 18:11:44 +0100 |
commit | f4b28747dced428a2282ad69026b5b54712d616c (patch) | |
tree | 38f28f5dc815e35fc5cdfa90c6eb96c7d816b9ec /methods/server.cc | |
parent | 9735e1d76cf1ab3973460a682eea3a1948c1c1d9 (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
(cherry picked from commit 4759a702081297bde66982efed8b2b7fd39ca27c)
(cherry picked from commit b5d0e1be09fd07e693bae8046848059f578d029f)
Diffstat (limited to 'methods/server.cc')
-rw-r--r-- | methods/server.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/methods/server.cc b/methods/server.cc index e260708c5..cac77e24c 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -192,7 +192,11 @@ bool ServerState::HeaderLine(string 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; |