]> git.saurik.com Git - apt.git/blobdiff - methods/https.cc
* merge lp:~mvo/apt/netrc branch, this adds support for a
[apt.git] / methods / https.cc
index 79e6fea3f42d6c1b173993a6092ba5d1a71329da..3717ded7be85ce6581a9ec97ca85d795a170edfb 100644 (file)
@@ -14,6 +14,7 @@
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/netrc.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -126,8 +127,10 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    curl_easy_reset(curl);
    SetupProxy();
 
+   maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc"));
+
    // callbacks
-   curl_easy_setopt(curl, CURLOPT_URL, Itm->Uri.c_str());
+   curl_easy_setopt(curl, CURLOPT_URL, static_cast<string>(Uri).c_str());
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
    curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback);
@@ -213,8 +216,10 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
 
    // set timeout
    int timeout = _config->FindI("Acquire::http::Timeout",120);
-   curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, timeout);
+   //set really low lowspeed timeout (see #497983)
+   curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, DL_MIN_SPEED);
+   curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, timeout);
 
    // set redirect options and default to 10 redirects
    bool AllowRedirect = _config->FindI("Acquire::https::AllowRedirect", true);