]> git.saurik.com Git - apt.git/commitdiff
make https honor ExpectedSize as well
authorMichael Vogt <mvo@debian.org>
Wed, 27 Aug 2014 02:20:04 +0000 (19:20 -0700)
committerMichael Vogt <mvo@debian.org>
Wed, 27 Aug 2014 02:20:04 +0000 (19:20 -0700)
methods/https.cc
methods/https.h

index e0348ab58f7fd36b96e8c140f4eaf2bd31ff0cf1..cacd8a6bc9e2985b83611b47fdf18000ab0b53b4 100644 (file)
@@ -81,6 +81,12 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp)
    if(me->File->Write(buffer, size*nmemb) != true)
       return false;
 
    if(me->File->Write(buffer, size*nmemb) != true)
       return false;
 
+   me->TotalWritten += size*nmemb;
+   if(me->TotalWritten > me->Queue->ExpectedSize)
+      return _error->Error("Writing more data than expected (%llu > %llu)",
+                           me->TotalWritten, me->Queue->ExpectedSize);
+
+
    return size*nmemb;
 }
 
    return size*nmemb;
 }
 
index faac8a3cdae8c247b103e44baaec5146d5d02fe3..2335559fb0e4073020e2ddd53f60b8b57553b0d0 100644 (file)
@@ -66,11 +66,12 @@ class HttpsMethod : public pkgAcqMethod
    CURL *curl;
    FetchResult Res;
    HttpsServerState *Server;
    CURL *curl;
    FetchResult Res;
    HttpsServerState *Server;
+   unsigned long long TotalWritten;
 
    public:
    FileFd *File;
       
 
    public:
    FileFd *File;
       
-   HttpsMethod() : pkgAcqMethod("1.2",Pipeline | SendConfig), File(NULL)
+   HttpsMethod() : pkgAcqMethod("1.2",Pipeline | SendConfig), TotalWritten(0), File(NULL)
    {
       File = 0;
       curl = curl_easy_init();
    {
       File = 0;
       curl = curl_easy_init();