Przeglądaj źródła

Add timeout support for https.

Otavio Salvador 18 lat temu
rodzic
commit
cc615257a9
2 zmienionych plików z 7 dodań i 1 usunięć
  1. 2 0
      debian/changelog
  2. 5 1
      methods/https.cc

+ 2 - 0
debian/changelog

@@ -4,6 +4,8 @@ apt (0.7.13) UNRELEASED; urgency=low
     Closes: #478231
     Closes: #478231
   * Make cron script quiet if cache is locked. Thanks to Ted Percival
   * Make cron script quiet if cache is locked. Thanks to Ted Percival
     <ted@midg3t.net> for the patch. Closes: #459344
     <ted@midg3t.net> for the patch. Closes: #459344
+  * Add timeout support for https. Thanks to Andrew Martens
+    <andrew.martens@strangeloopnetworks.com> for the patch.
 
 
   [ Program translations ]
   [ Program translations ]
     - Vietnamese updated. Closes: #479008
     - Vietnamese updated. Closes: #479008

+ 5 - 1
methods/https.cc

@@ -110,7 +110,6 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    long curl_responsecode;
    long curl_responsecode;
 
 
    // TODO:
    // TODO:
-   //       - http::Timeout
    //       - http::Pipeline-Depth
    //       - http::Pipeline-Depth
    //       - error checking/reporting
    //       - error checking/reporting
    //       - more debug options? (CURLOPT_DEBUGFUNCTION?)
    //       - more debug options? (CURLOPT_DEBUGFUNCTION?)
@@ -169,6 +168,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    // set header
    // set header
    curl_easy_setopt(curl, CURLOPT_USERAGENT,"Debian APT-CURL/1.0 ("VERSION")");
    curl_easy_setopt(curl, CURLOPT_USERAGENT,"Debian APT-CURL/1.0 ("VERSION")");
 
 
+   // set timeout
+   int timeout = _config->FindI("Acquire::http::Timeout",120);
+   curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
+   curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, timeout);
+
    // debug
    // debug
    if(_config->FindB("Debug::Acquire::https", false))
    if(_config->FindB("Debug::Acquire::https", false))
       curl_easy_setopt(curl, CURLOPT_VERBOSE, true);
       curl_easy_setopt(curl, CURLOPT_VERBOSE, true);