From 43cf55db7c2ce7015d365556ed9ab0b8b2cec3ca Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Nov 2009 09:51:31 -0600 Subject: * methods/https.cc: - fix incorrect use of CURLOPT_TIMEOUT, closes: #497983, LP: #354972 thanks to Brian Thomason for the patch --- methods/https.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'methods') diff --git a/methods/https.cc b/methods/https.cc index 37d93e308..3cbb0088a 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -212,8 +212,11 @@ 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) + int dlMin = 1; + curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, dlMin); + 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); -- cgit v1.2.3 From 5085e660679cdbb51783702898c42000d5db4fba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Nov 2009 09:55:22 -0600 Subject: methods/https.cc: cleanup for CURLOPT_LOW_SPEED_TIME --- methods/https.cc | 3 +-- methods/https.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/https.cc b/methods/https.cc index 3cbb0088a..dbc1cf52c 100644 --- a/methods/https.cc +++ b/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 diff --git a/methods/https.h b/methods/https.h index 2c33d95ee..3f0c416b6 100644 --- a/methods/https.h +++ b/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); -- cgit v1.2.3