summaryrefslogtreecommitdiff
path: root/methods/server.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-08-11 18:24:35 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-08-16 18:49:37 +0200
commitd94b1d80d8326334d17f6a43061368e783b8e0aa (patch)
tree7b248c4adecf84184dc823ada6f654c7e0f46f06 /methods/server.cc
parentebdb6f1810a20ac240b5b2192dc2e6532ff149d2 (diff)
don't sent Range requests if we know its not accepted
If the server told us in a previous request that it isn't supporting Ranges with bytes via an Accept-Ranges header missing bytes, we don't try to formulate requests using Ranges.
Diffstat (limited to 'methods/server.cc')
-rw-r--r--methods/server.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/methods/server.cc b/methods/server.cc
index d0b6ef3d7..aa1ee4754 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -227,6 +227,15 @@ bool ServerState::HeaderLine(string Line)
return true;
}
+ if (stringcasecmp(Tag, "Accept-Ranges:") == 0)
+ {
+ std::string ranges = ',' + Val + ',';
+ ranges.erase(std::remove(ranges.begin(), ranges.end(), ' '), ranges.end());
+ if (ranges.find(",bytes,") == std::string::npos)
+ RangesAllowed = false;
+ return true;
+ }
+
return true;
}
/*}}}*/
@@ -252,6 +261,7 @@ void ServerState::Reset(bool const Everything) /*{{{*/
if (Everything)
{
Persistent = false; Pipeline = false; PipelineAllowed = true;
+ RangesAllowed = true;
}
}
/*}}}*/