From 4759a702081297bde66982efed8b2b7fd39ca27c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 18 Jan 2017 20:39:27 +0100 Subject: 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 --- methods/basehttp.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3