Explorar o código

methods/https.cc: cleanup for CURLOPT_LOW_SPEED_TIME

Michael Vogt %!s(int64=16) %!d(string=hai) anos
pai
achega
5085e66067
Modificáronse 2 ficheiros con 3 adicións e 2 borrados
  1. 1 2
      methods/https.cc
  2. 2 0
      methods/https.h

+ 1 - 2
methods/https.cc

@@ -214,8 +214,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    int timeout = _config->FindI("Acquire::http::Timeout",120);
    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, timeout);
    //set really low lowspeed timeout (see #497983)
-   int dlMin = 1;
-   curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, dlMin);
+   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

+ 2 - 0
methods/https.h

@@ -24,6 +24,8 @@ class HttpsMethod;
 
 class HttpsMethod : public pkgAcqMethod
 {
+   // minimum speed in bytes/se that triggers download timeout handling
+   static const int DL_MIN_SPEED = 10;
 
    virtual bool Fetch(FetchItem *);
    static size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);