summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-10-03 02:06:37 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-10-03 02:06:37 +0200
commit18a14a834e4068917d97467a3a52f17ed6055da3 (patch)
tree04001afdb2078ff74813ef4c97a09a4c65cf641b /methods
parent59d5cc74ef7c6ca820ed9d26a4d829b891214edf (diff)
parenta491fe600cdcf28ee9515d4fde02345be93a0f9c (diff)
- French updated
- Basque updated. Closes: #436425 - Fix the zh_CN translator's name in debian/changelog for 0.7.2 Closes: #423272 - Vietnamese updated. Closes: #440611 - Danish updated. Closes: #441102 - Thai added. Closes: #442833 * Add hash support to copy method. Thanks Anders Kaseorg by the patch (closes: #436055) * Reset curl options and timestamp between downloaded files. Thanks to Ryan Murray <rmurray@debian.org> for the patch (closes: #437150) * Add support to apt-key to export keys to stdout. Thanks to "Dwayne C. Litzenberger" <dlitz@dlitz.net> for the patch (closes: #441942) * Fix compilation warnings: - apt-pkg/indexfile.cc: conversion from string constant to 'char*'; - apt-pkg/acquire-item.cc: likewise; - apt-pkg/cdrom.cc: '%lu' expects 'long unsigned int', but argument has type 'size_t'; - apt-pkg/deb/dpkgpm.cc: initialization order and conversion from string constant to 'char*'; - methods/gpgv.cc: conversion from string constant to 'char*'; - methods/ftp.cc: likewise; - cmdline/apt-extracttemplates.cc: likewise; - apt-pkg/deb/debmetaindex.cc: comparison with string literal results in unspecified behaviour; * Applied patch from Aurelien Jarno <aurel32@debian.org> to fix wrong directory downloading on non-linux architectures (closes: #435597) * zh_CN.po: Updated by Kov Chai Closes: #416822
Diffstat (limited to 'methods')
-rw-r--r--methods/copy.cc5
-rw-r--r--methods/ftp.cc2
-rw-r--r--methods/gpgv.cc6
-rw-r--r--methods/https.cc13
4 files changed, 22 insertions, 4 deletions
diff --git a/methods/copy.cc b/methods/copy.cc
index d737e3c33..72896b4c0 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -12,6 +12,7 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/hashes.h>
#include <sys/stat.h>
#include <utime.h>
@@ -79,6 +80,10 @@ bool CopyMethod::Fetch(FetchItem *Itm)
return _error->Errno("utime",_("Failed to set modification time"));
}
+ Hashes Hash;
+ FileFd Fd(Res.Filename, FileFd::ReadOnly);
+ Hash.AddFD(Fd.Fd(), Fd.Size());
+ Res.TakeHashes(Hash);
URIDone(Res);
return true;
}
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 0c2aa00a7..554a24cf5 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -1101,7 +1101,7 @@ int main(int argc,const char *argv[])
char S[300];
snprintf(S,sizeof(S),"http_proxy=%s",getenv("ftp_proxy"));
putenv(S);
- putenv("no_proxy=");
+ putenv((char *)"no_proxy=");
// Run the http method
string Path = flNotFile(argv[0]) + "http";
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 227e08d63..2b1fa5169 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -121,9 +121,9 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
// Redirect the pipe to the status fd (3)
dup2(fd[1], 3);
- putenv("LANG=");
- putenv("LC_ALL=");
- putenv("LC_MESSAGES=");
+ putenv((char *)"LANG=");
+ putenv((char *)"LC_ALL=");
+ putenv((char *)"LC_MESSAGES=");
execvp(gpgvpath.c_str(), (char **)Args);
exit(111);
diff --git a/methods/https.cc b/methods/https.cc
index e6717e63a..3b2b0bb19 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -115,6 +115,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
// - error checking/reporting
// - more debug options? (CURLOPT_DEBUGFUNCTION?)
+ curl_easy_reset(curl);
SetupProxy();
// callbacks
@@ -125,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_FILETIME, true);
// FIXME: https: offer various options of verification
bool peer_verify = _config->FindB("Acquire::https::Verify-Peer", false);
@@ -202,6 +204,9 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
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 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
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)