summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2016-12-02 11:53:53 +0100
committerAllan McRae <allan@archlinux.org>2017-01-13 03:52:50 +0100
commitc635f185ba86967cd8de9c31890b57e558f65e9b (patch)
tree8a41eb52b90e9afc595b5d08016f3f4102ccf646 /lib
parent64bd242863504b6ffe138dc8af2b7c6d7a353f76 (diff)
downloadpacman-c635f185ba86967cd8de9c31890b57e558f65e9b.tar.gz
pacman-c635f185ba86967cd8de9c31890b57e558f65e9b.tar.xz
Introduce a 'disable-download-timeout' option
Add command line option ('--disable-download-timeout') and config file option ('DisableDownloadTimeout') to disable defaults for low speed limit and timeout on downloads. Use this if you have issues downloading files with proxy and/or security gateway. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/dload.c6
-rw-r--r--lib/libalpm/handle.c10
-rw-r--r--lib/libalpm/handle.h1
4 files changed, 17 insertions, 2 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 49cf200a..448d42d2 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -926,6 +926,8 @@ int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level);
int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle);
int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level);
+int alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, unsigned short disable_dl_timeout);
+
/** @} */
/** @addtogroup alpm_api_databases Database Functions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 17e4f3a6..875b689c 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -264,8 +264,10 @@ static void curl_set_handle_opts(struct dload_payload *payload,
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, (void *)payload);
- curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
- curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
+ if(!handle->disable_dl_timeout) {
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
+ curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
+ }
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, dload_parseheader_cb);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *)payload);
curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 5a5cd448..f08f614c 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -844,4 +844,14 @@ int SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle)
}
}
+int SYMEXPORT alpm_option_set_disable_dl_timeout(alpm_handle_t *handle,
+ unsigned short disable_dl_timeout)
+{
+ CHECK_HANDLE(handle, return -1);
+#ifdef HAVE_LIBCURL
+ handle->disable_dl_timeout = disable_dl_timeout;
+#endif
+ return 0;
+}
+
/* vim: set noet: */
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index e096bfb3..223eac12 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -60,6 +60,7 @@ struct __alpm_handle_t {
#ifdef HAVE_LIBCURL
/* libcurl handle */
CURL *curl; /* reusable curl_easy handle */
+ unsigned short disable_dl_timeout;
#endif
#ifdef HAVE_LIBGPGME