X-Git-Url: http://git.hcoop.net/ntk/apt.git/blobdiff_plain/d3e8fbb395f57954acd7a2095f02ce530a05ec6a..c6ee61eab54edf6cc3fbe118d304d72a860e1451:/methods/https.cc diff --git a/methods/https.cc b/methods/https.cc index b0c7ee71..0499af0c 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -18,19 +18,21 @@ #include #include #include +#include +#include +#include #include #include #include -#include #include -#include -#include #include #include +#include +#include -#include "config.h" #include "https.h" + #include /*}}}*/ using namespace std; @@ -83,9 +85,9 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp) return size*nmemb; } -int -HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow, - double ultotal, double ulnow) +int +HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/, + double /*ultotal*/, double /*ulnow*/) { HttpsMethod *me = (HttpsMethod *)clientp; if(dltotal > 0 && me->Res.Size == 0) { @@ -95,7 +97,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow, } // HttpsServerState::HttpsServerState - Constructor /*{{{*/ -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); Reset(); @@ -106,6 +108,9 @@ void HttpsMethod::SetupProxy() /*{{{*/ { URI ServerName = Queue->Uri; + // Determine the proxy setting + AutoDetectProxy(ServerName); + // Curl should never read proxy settings from the environment, as // we determine which proxy to use. Do this for consistency among // methods and prevent an environment variable overriding a @@ -324,11 +329,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm) // if we have the file send an if-range query with a range header if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0) { - char Buf[1000]; - sprintf(Buf, "Range: bytes=%li-", (long) SBuf.st_size); - headers = curl_slist_append(headers, Buf); - sprintf(Buf, "If-Range: %s", TimeRFC1123(SBuf.st_mtime).c_str()); - headers = curl_slist_append(headers, Buf); + std::string Buf; + strprintf(Buf, "Range: bytes=%lli-", (long long) SBuf.st_size); + headers = curl_slist_append(headers, Buf.c_str()); + strprintf(Buf, "If-Range: %s", TimeRFC1123(SBuf.st_mtime).c_str()); + headers = curl_slist_append(headers, Buf.c_str()); } else if(Itm->LastModified > 0) {