Christian Hesse <list@eworm.de> on Mon, 2022/09/19 14:52:
By setting the HTTP header 'Cache-Control: no-cache' when returning with the status code 404 (not found) the server can indicate that this is a soft failure. No error message is shown, and server's error count is not increased.
This can be used by servers that are not expected to be complete, for example when serving a local cache [0]. In nginx this can be achived by adding a single directive in location block:
add_header Cache-Control "no-cache";
Yes, I know. We had a very similar patch in May 2021 [2]. That one received a negative review, possibly because back then I wanted to introduce a custom and non-standard http header 'X-Pacman-Expected-Failure'. In January 2022 I send a patch to implement CacheServer [3], that one was neither reviewed nor merged. At least not yet, and it is a lot more complex. As this is still a problem in general (and not just a "kind of esoteric setup", see the number of caching solutions listed on pacman's wiki page) [0] I decided to make another try. In contrast to the original patch I decided to go with a standard http header. If the server sends 'Cache-Control: no-cache' in its response header pacman will honor that as a soft failure and will not increase server's error limit. That said... I am open to other suggestions for a header that matches even better. Could not find one myself. I am running this code myself for month now (with a custom built pacman package) without issue. It does exactly what I need, and will help others as well.
Also this is a perfect match for pacredir [1].
... which will receive a corresponding commit as soon as this is merged. BTW, did you know that pacredir is in our official repositories since 2017? It gives an advice to install pacman (the custom build I mentioned above) from an unofficial repository since version 6.0 entered the repositories. This could finally be dropped.
[0] https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Network_shared_pacma... [1] https://git.eworm.de/cgit/pacredir/about/
[2] https://lists.archlinux.org/archives/list/pacman-dev@lists.archlinux.org/mes... [3] https://lists.archlinux.org/archives/list/pacman-dev@lists.archlinux.org/mes... -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}