]> git.saurik.com Git - apt.git/blobdiff - methods/https.cc
- French updated
[apt.git] / methods / https.cc
index 7a6148d146999dafb9558992e215cb646b0ea12d..3b2b0bb19e3dfb8c2ac6139ee0955f1a54fc5fc9 100644 (file)
@@ -3,7 +3,7 @@
 // $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
 /* ######################################################################
 
 // $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
 /* ######################################################################
 
-   HTTPS Aquire Method - This is the HTTPS aquire method for APT.
+   HTTPS Acquire Method - This is the HTTPS aquire method for APT.
    
    It uses libcurl
 
    
    It uses libcurl
 
@@ -50,13 +50,13 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow,
 {
    HttpsMethod *me = (HttpsMethod *)clientp;
    if(dltotal > 0 && me->Res.Size == 0) {
 {
    HttpsMethod *me = (HttpsMethod *)clientp;
    if(dltotal > 0 && me->Res.Size == 0) {
-      me->Res.Size = dltotal;
+      me->Res.Size = (unsigned long)dltotal;
       me->URIStart(me->Res);
    }
    return 0;
 }
 
       me->URIStart(me->Res);
    }
    return 0;
 }
 
-bool HttpsMethod::SetupProxy()
+void HttpsMethod::SetupProxy()
 {
    URI ServerName = Queue->Uri;
 
 {
    URI ServerName = Queue->Uri;
 
@@ -84,7 +84,6 @@ bool HttpsMethod::SetupProxy()
    }
    
    // Determine what host and port to use based on the proxy settings
    }
    
    // Determine what host and port to use based on the proxy settings
-   int Port = 0;
    string Host;   
    if (Proxy.empty() == true || Proxy.Host.empty() == true)
    {
    string Host;   
    if (Proxy.empty() == true || Proxy.Host.empty() == true)
    {
@@ -116,6 +115,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    //       - error checking/reporting
    //       - more debug options? (CURLOPT_DEBUGFUNCTION?)
 
    //       - error checking/reporting
    //       - more debug options? (CURLOPT_DEBUGFUNCTION?)
 
+   curl_easy_reset(curl);
    SetupProxy();
 
    // callbacks
    SetupProxy();
 
    // callbacks
@@ -126,6 +126,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this);
    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
    curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
    curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this);
    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
    curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
+   curl_easy_setopt(curl, CURLOPT_FILETIME, true);
 
    // FIXME: https: offer various options of verification
    bool peer_verify = _config->FindB("Acquire::https::Verify-Peer", false);
 
    // FIXME: https: offer various options of verification
    bool peer_verify = _config->FindB("Acquire::https::Verify-Peer", false);
@@ -203,6 +204,9 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    CURLcode success = curl_easy_perform(curl);
    curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &curl_responsecode);
 
    CURLcode success = curl_easy_perform(curl);
    curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &curl_responsecode);
 
+   long curl_servdate;
+   curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate);
+
    // cleanup
    if(success != 0) 
    {
    // cleanup
    if(success != 0) 
    {
@@ -216,6 +220,14 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    if (Res.Size == 0)
       Res.Size = File->Size();
 
    if (Res.Size == 0)
       Res.Size = File->Size();
 
+   // Timestamp
+   struct utimbuf UBuf;
+   if (curl_servdate != -1) {
+       UBuf.actime = curl_servdate;
+       UBuf.modtime = curl_servdate;
+       utime(File->Name().c_str(),&UBuf);
+   }
+
    // check the downloaded result
    struct stat Buf;
    if (stat(File->Name().c_str(),&Buf) == 0)
    // check the downloaded result
    struct stat Buf;
    if (stat(File->Name().c_str(),&Buf) == 0)