summaryrefslogtreecommitdiff
path: root/methods/https.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-03-09 01:34:10 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-03-16 17:59:31 +0100
commitd61960d9244340956a27f4ca46aecd15cc75e18b (patch)
treec8f7cb33e08c84bcf06fbff39647dc03bc103afb /methods/https.cc
parentb0be0e09cfbbcb033eb0b92eaf17ac31a6b9f423 (diff)
parent1a0619ac765cc0b2f4906c96c1a4d7f510569a3f (diff)
merge debian/sid into debian/experimental
Diffstat (limited to 'methods/https.cc')
-rw-r--r--methods/https.cc28
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;