From d94b1d80d8326334d17f6a43061368e783b8e0aa Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 11 Aug 2016 18:24:35 +0200 Subject: 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. --- methods/http.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'methods/http.cc') diff --git a/methods/http.cc b/methods/http.cc index 8d34aa6e3..11136bb9a 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -906,7 +906,7 @@ void HttpMethod::SendReq(FetchItem *Itm) // Check for a partial file and send if-queries accordingly struct stat SBuf; - if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0) + if (Server->RangesAllowed && stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0) Req << "Range: bytes=" << std::to_string(SBuf.st_size) << "-\r\n" << "If-Range: " << TimeRFC1123(SBuf.st_mtime, false) << "\r\n"; else if (Itm->LastModified != 0) -- cgit v1.2.3