[pacman-dev] [PATCH 1/1] support http header to indicate an expected failure

Christian Hesse list at eworm.de
Fri May 28 09:07:54 UTC 2021


Allan McRae <allan at archlinux.org> on Fri, 2021/05/28 12:39:
> On 26/5/21 6:22 pm, Christian Hesse wrote:
> > Andrew Gregory <andrew.gregory.8 at gmail.com> on Mon, 2021/05/24 11:50:  
> >> On 05/24/21 at 08:31pm, Christian Hesse wrote:  
> >>> Christian Hesse <list at eworm.de> on Fri, 2021/05/21 10:06:    
> >>>> 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.    
> >>>
> >>> Any comment on this?
> >>> Where to document the behavior?
> >>>
> >>> BTW, this is the matching branch for pacredir:
> >>> https://github.com/eworm-de/pacredir/commits/404-header    
> >>de/pacredir/commits/404-header  
> >>
> >> I'm not a fan of having this be server-side.  
> > 
> > Would be a perfect fit for me and my use case. :-p
> > 
> > For those interested... I created simple flow charts to describe what
> > happens when pacman sends its requests to pacredir.
> > https://git.eworm.de/cgit/pacredir/about/FLOW.md
> >   
> 
> Thanks - that helps a bit.
> 
> I'm still confused about how pacredir updates databases from a mirror.
> I can see how it gets a database update from another host.  Can you clarify?

Ok, let's see a more detailed example:

* pacman sends a request to pacredir, the header contains a timestamp from
  synced database file in /var/lib/pacman/sync/:
  If-Modified-Since: Fri, 28 May 2021 04:38:25 GMT
* pacredir sends HEAD requests to pacserve on hosts in local network
* pacserve answers with 200, but the header contains a timestamp:
  Last-Modified: Fri, 28 May 2021 04:38:25 GMT
* pacredir sends a 307 with redirect to the host with most recent db file - or
  404 if all requested db files are older or of same age as local file
-- 
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);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20210528/1488058f/attachment.sig>


More information about the pacman-dev mailing list