diff options
Diffstat (limited to 'methods/https.cc')
-rw-r--r-- | methods/https.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/methods/https.cc b/methods/https.cc index 23b3a10d4..37a8ff5fd 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -95,24 +95,33 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp) if (me->Server->JunkSize != 0) return buffer_size; - if (me->Res.Size == 0) + if (me->Server->ReceivedData == false) + { me->URIStart(me->Res); + me->Server->ReceivedData = true; + } + if(me->File->Write(buffer, buffer_size) != true) - return false; + return 0; - if(me->Queue->MaximumSize > 0 && me->File->Tell() > me->Queue->MaximumSize) + if(me->Queue->MaximumSize > 0) { - me->SetFailReason("MaximumSizeExceeded"); - _error->Error("Writing more data than expected (%llu > %llu)", - me->TotalWritten, me->Queue->MaximumSize); - return 0; + unsigned long long const TotalWritten = me->File->Tell(); + if (TotalWritten > me->Queue->MaximumSize) + { + me->SetFailReason("MaximumSizeExceeded"); + _error->Error("Writing more data than expected (%llu > %llu)", + TotalWritten, me->Queue->MaximumSize); + return 0; + } } + return buffer_size; } int HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/, - double /*ultotal*/, double /*ulnow*/) + double /*ultotal*/, double /*ulnow*/) { HttpsMethod *me = (HttpsMethod *)clientp; if(dltotal > 0 && me->Res.Size == 0) { @@ -125,6 +134,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/, HttpsServerState::HttpsServerState(URI Srv,HttpsMethod * /*Owner*/) : ServerState(Srv, NULL) { TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut); + ReceivedData = false; Reset(); } /*}}}*/ @@ -192,7 +202,7 @@ void HttpsMethod::SetupProxy() /*{{{*/ bool HttpsMethod::Fetch(FetchItem *Itm) { struct stat SBuf; - struct curl_slist *headers=NULL; + struct curl_slist *headers=NULL; char curl_errorstr[CURL_ERROR_SIZE]; URI Uri = Itm->Uri; string remotehost = Uri.Host; |