aboutsummaryrefslogtreecommitdiffstats
path: root/patches/0001-support-http-header-to-indicate-an-expected-failure.patch
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-09-15 13:57:27 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-09-15 15:38:47 +0200
commitac886bea59fe3e8b9b136f2a650b43dafae6a1b3 (patch)
tree35d242a1537ef464896083e93d56a8b19ed5503e /patches/0001-support-http-header-to-indicate-an-expected-failure.patch
parent9bebcd9c517e575a023be0d1843acc4054d1363e (diff)
downloadpacredir-ac886bea59fe3e8b9b136f2a650b43dafae6a1b3.tar.gz
pacredir-ac886bea59fe3e8b9b136f2a650b43dafae6a1b3.tar.zst
use http header 'Cache-Control: no-cache' for soft failure
This is standard header...
Diffstat (limited to 'patches/0001-support-http-header-to-indicate-an-expected-failure.patch')
-rw-r--r--patches/0001-support-http-header-to-indicate-an-expected-failure.patch43
1 files changed, 0 insertions, 43 deletions
diff --git a/patches/0001-support-http-header-to-indicate-an-expected-failure.patch b/patches/0001-support-http-header-to-indicate-an-expected-failure.patch
deleted file mode 100644
index 6bc977a..0000000
--- a/patches/0001-support-http-header-to-indicate-an-expected-failure.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From b50863ad56c3c972e4bfbc9108523fee267d63fa Mon Sep 17 00:00:00 2001
-From: Christian Hesse <mail@eworm.de>
-Date: Fri, 21 May 2021 09:52:34 +0200
-Subject: [PATCH] support http header to indicate an expected failure
-
-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 7c27c3ea..d39125ca 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;
-
-@@ -303,6 +304,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;