summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-05-09 19:55:41 -0400
committerAllan McRae <allan@archlinux.org>2014-05-22 15:52:22 +1000
commit7a5e41925f72d838eaa611427e5ae89b1f57215f (patch)
tree59f68301b23175e4a33b853ab3417b03fdb4f9ca /lib
parentb929e74f2ebc1b7102d57cd22a5e986cead5bd4b (diff)
downloadpacman-7a5e41925f72d838eaa611427e5ae89b1f57215f.tar.xz
dload: avoid using CURLOPT_FAILONERROR
Use of this flag causes connections to be closed on 404s -- a common occurrence when your config sets DatabaseOptional. Handle the error gracefully, so that the connection can be reused. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 53867f5b..88ea4279 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -286,7 +286,6 @@ static void curl_set_handle_opts(struct dload_payload *payload,
* to reset the handle's parameters for each time it's used. */
curl_easy_reset(curl);
curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
- curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
@@ -478,12 +477,14 @@ static int curl_download_internal(struct dload_payload *payload,
_alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", payload->respcode);
if(payload->respcode >= 400) {
payload->unlink_on_fail = 1;
- /* non-translated message is same as libcurl */
- snprintf(error_buffer, sizeof(error_buffer),
- "The requested URL returned error: %ld", payload->respcode);
- _alpm_log(handle, ALPM_LOG_ERROR,
- _("failed retrieving file '%s' from %s : %s\n"),
- payload->remote_name, hostname, error_buffer);
+ if(!payload->errors_ok) {
+ /* non-translated message is same as libcurl */
+ snprintf(error_buffer, sizeof(error_buffer),
+ "The requested URL returned error: %ld", payload->respcode);
+ _alpm_log(handle, ALPM_LOG_ERROR,
+ _("failed retrieving file '%s' from %s : %s\n"),
+ payload->remote_name, hostname, error_buffer);
+ }
goto cleanup;
}
break;