X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/05f64ca2e483709faa6bc69dfa79129d2d4c679e..769e9f3ea1cbe67d3b98e6db6c956abde2384868:/methods/http.cc?ds=sidebyside diff --git a/methods/http.cc b/methods/http.cc index af3d5ccb6..fc54ece3a 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -442,12 +441,12 @@ bool HttpServerState::RunData(FileFd * const File) { /* Closes encoding is used when the server did not specify a size, the loss of the connection means we are done */ - if (Persistent == false) - In.Limit(-1); - else if (JunkSize != 0) + if (JunkSize != 0) In.Limit(JunkSize); - else - In.Limit(Size - StartPos); + else if (DownloadSize != 0) + In.Limit(DownloadSize); + else if (Persistent == false) + In.Limit(-1); // Just transfer the whole block. do @@ -708,7 +707,7 @@ void HttpMethod::SendReq(FetchItem *Itm) C.f. https://tools.ietf.org/wg/httpbis/trac/ticket/158 */ Req << "GET " << requesturi << " HTTP/1.1\r\n"; if (Uri.Port != 0) - Req << "Host: " << ProperHost << ":" << Uri.Port << "\r\n"; + Req << "Host: " << ProperHost << ":" << std::to_string(Uri.Port) << "\r\n"; else Req << "Host: " << ProperHost << "\r\n"; @@ -717,7 +716,7 @@ void HttpMethod::SendReq(FetchItem *Itm) Req << "Cache-Control: no-cache\r\n" << "Pragma: no-cache\r\n"; else if (Itm->IndexFile == true) - Req << "Cache-Control: max-age=" << _config->FindI("Acquire::http::Max-Age",0) << "\r\n"; + Req << "Cache-Control: max-age=" << std::to_string(_config->FindI("Acquire::http::Max-Age",0)) << "\r\n"; else if (_config->FindB("Acquire::http::No-Store",false) == true) Req << "Cache-Control: no-store\r\n"; @@ -778,9 +777,9 @@ bool HttpMethod::Configuration(string Message) return true; } /*}}}*/ -ServerState * HttpMethod::CreateServerState(URI uri) /*{{{*/ +std::unique_ptr HttpMethod::CreateServerState(URI const &uri)/*{{{*/ { - return new HttpServerState(uri, this); + return std::unique_ptr(new HttpServerState(uri, this)); } /*}}}*/ void HttpMethod::RotateDNS() /*{{{*/