diff options
author | Sam Bingner <sam@bingner.com> | 2019-08-17 20:00:42 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-08-18 12:07:59 -1000 |
commit | d4baec84f5a6a8484b7b7c284184721c748b6dc2 (patch) | |
tree | 7f0a1ecc106a52716d64c4fcc5b83f06ddbcefa0 /methods/http.cc | |
parent | 23dbbe24511b0a5db2ef47a3846cd59b7fb9a106 (diff) |
Cleanup patches for 1.8.2
Diffstat (limited to 'methods/http.cc')
-rw-r--r-- | methods/http.cc | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/methods/http.cc b/methods/http.cc index 647b35c6b..16c0de611 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -164,32 +164,28 @@ void HttpMethod::RotateDNS() /*{{{*/ { } /*}}}*/ -BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res)/*{{{*/ +BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)/*{{{*/ { - auto ret = BaseHttpMethod::DealWithHeaders(Res); + auto ret = BaseHttpMethod::DealWithHeaders(Res, Req); if (ret != BaseHttpMethod::FILE_IS_OPEN) return ret; - - // Open the file - delete File; - File = new FileFd(Queue->DestFile,FileFd::WriteAny); - if (_error->PendingError() == true) + if (Req.File.Open(Queue->DestFile, FileFd::WriteAny) == false) return ERROR_NOT_FROM_SERVER; FailFile = Queue->DestFile; FailFile.c_str(); // Make sure we don't do a malloc in the signal handler - FailFd = File->Fd(); - FailTime = Server->Date; + FailFd = Req.File.Fd(); + FailTime = Req.Date; - if (Server->InitHashes(Queue->ExpectedHashes) == false || Server->AddPartialFileToHashes(*File) == false) + if (Server->InitHashes(Queue->ExpectedHashes) == false || Req.AddPartialFileToHashes(Req.File) == false) { _error->Errno("read",_("Problem hashing file")); return ERROR_NOT_FROM_SERVER; } - if (Server->StartPos > 0) - Res.ResumePoint = Server->StartPos; + if (Req.StartPos > 0) + Res.ResumePoint = Req.StartPos; - SetNonBlock(File->Fd(),true); + SetNonBlock(Req.File.Fd(),true); return FILE_IS_OPEN; } @@ -544,22 +540,14 @@ int HttpMethod::Loop() return 0; } - /*}}}*/ HttpMethod::HttpMethod(std::string &&pProg) : BaseHttpMethod(pProg.c_str(), "1.2", Pipeline | SendConfig)/*{{{*/ { - SeccompFlags = aptMethod::BASE | aptMethod::NETWORK; - auto addName = std::inserter(methodNames, methodNames.begin()); - if (Binary != "http") + if (Binary != "http" && Binary != "https") addName = "http"; auto const plus = Binary.find('+'); if (plus != std::string::npos) - { - auto name2 = Binary.substr(plus + 1); - if (std::find(methodNames.begin(), methodNames.end(), name2) == methodNames.end()) - addName = std::move(name2); addName = Binary.substr(0, plus); - } File = 0; Server = 0; } |