From: Christian Hesse <mail@eworm.de> By setting an extra HTTP header 'X-Pacman-Expected-Failure' the server can indicate that the failure is expected. The next server is tried without error message and without increasing the server's error count. This can be used by servers that are not expected to be complete, for example when serving a local cache. Signed-off-by: Christian Hesse <mail@eworm.de> --- lib/libalpm/dload.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index f6a4f012..e6e0a6f5 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -277,6 +277,7 @@ static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *u const char *fptr, *endptr = NULL; const char * const cd_header = "Content-Disposition:"; const char * const fn_key = "filename="; + const char * const xpef_header = "X-Pacman-Expected-Failure:"; struct dload_payload *payload = (struct dload_payload *)user; long respcode; @@ -300,6 +301,13 @@ static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *u } } + /* By setting an extra HTTP header 'X-Pacman-Expected-Failure' the server can + indicate that the failure is expected. The next server is tried without + error message and without increasing the server's error count. */ + if(_alpm_raw_ncmp(xpef_header, ptr, strlen(xpef_header)) == 0) { + payload->errors_ok = 1; + } + curl_easy_getinfo(payload->curl, CURLINFO_RESPONSE_CODE, &respcode); if(payload->respcode != respcode) { payload->respcode = respcode;