|
@@ -95,24 +95,33 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp)
|
|
|
if (me->Server->JunkSize != 0)
|
|
if (me->Server->JunkSize != 0)
|
|
|
return buffer_size;
|
|
return buffer_size;
|
|
|
|
|
|
|
|
- if (me->Res.Size == 0)
|
|
|
|
|
|
|
+ if (me->Server->ReceivedData == false)
|
|
|
|
|
+ {
|
|
|
me->URIStart(me->Res);
|
|
me->URIStart(me->Res);
|
|
|
|
|
+ me->Server->ReceivedData = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if(me->File->Write(buffer, buffer_size) != 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;
|
|
return buffer_size;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int
|
|
int
|
|
|
HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/,
|
|
HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/,
|
|
|
- double /*ultotal*/, double /*ulnow*/)
|
|
|
|
|
|
|
+ double /*ultotal*/, double /*ulnow*/)
|
|
|
{
|
|
{
|
|
|
HttpsMethod *me = (HttpsMethod *)clientp;
|
|
HttpsMethod *me = (HttpsMethod *)clientp;
|
|
|
if(dltotal > 0 && me->Res.Size == 0) {
|
|
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)
|
|
HttpsServerState::HttpsServerState(URI Srv,HttpsMethod * /*Owner*/) : ServerState(Srv, NULL)
|
|
|
{
|
|
{
|
|
|
TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut);
|
|
TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut);
|
|
|
|
|
+ ReceivedData = false;
|
|
|
Reset();
|
|
Reset();
|
|
|
}
|
|
}
|
|
|
/*}}}*/
|
|
/*}}}*/
|
|
@@ -192,7 +202,7 @@ void HttpsMethod::SetupProxy() /*{{{*/
|
|
|
bool HttpsMethod::Fetch(FetchItem *Itm)
|
|
bool HttpsMethod::Fetch(FetchItem *Itm)
|
|
|
{
|
|
{
|
|
|
struct stat SBuf;
|
|
struct stat SBuf;
|
|
|
- struct curl_slist *headers=NULL;
|
|
|
|
|
|
|
+ struct curl_slist *headers=NULL;
|
|
|
char curl_errorstr[CURL_ERROR_SIZE];
|
|
char curl_errorstr[CURL_ERROR_SIZE];
|
|
|
URI Uri = Itm->Uri;
|
|
URI Uri = Itm->Uri;
|
|
|
string remotehost = Uri.Host;
|
|
string remotehost = Uri.Host;
|