Package: apt-transport-https
Version: 0.7.6
Severity: normal

The following patch address two problems in the apt https method:

1. the curl options aren't reset between files, causing the previous files
settings to be used for the next, which can be a problem if the setting was
a lastmodified or range request.
2. Downloaded files aren't set to the time of the remote server (if available).
This breaks 304 support compared to the http method, as the files always have
the last downloaded time, rather than the last time from the web server.

This patch is against bzr revno 1517 of methods/https.cc

--- /home/rmurray/aptbzr/methods/https.cc       2007-08-09 20:32:36.707623733 
-0700
+++ /home/rmurray/https.cc      2007-08-10 10:51:54.015466148 -0700
@@ -115,6 +115,7 @@
    //       - error checking/reporting
    //       - more debug options? (CURLOPT_DEBUGFUNCTION?)
 
+   curl_easy_reset(curl);
    SetupProxy();
 
    // callbacks
@@ -125,6 +126,7 @@
    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);
@@ -202,6 +204,9 @@
    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) 
    {
@@ -215,6 +220,14 @@
    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)

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.20.15 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_CA, LC_CTYPE=en_CA (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt-transport-https depends on:
ii  apt [libapt-pkg-libc6.6-6-4.4 0.7.6      Advanced front-end for dpkg
ii  libc6                         2.6.1-1    GNU C Library: Shared libraries
ii  libcurl3-gnutls               7.16.4-2   Multi-protocol file transfer libra
ii  libgcc1                       1:4.2.1-2  GCC support library
ii  libstdc++6                    4.2.1-2    The GNU Standard C++ Library v3

apt-transport-https recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to