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 16:53:46 +0100 |
commit | b5d0e1be09fd07e693bae8046848059f578d029f (patch) | |
tree | 5a9fbd28f39f831844806163c84549498d273765 /methods/server.cc | |
parent | d0a345d4a41802e9129b78d70aabd6239a3c651a (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)
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 0408dddfd..164a98166 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -180,7 +180,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; |