[pacman-dev] [PATCH 1/1] RFC: handle soft failure in downloads

Christian Hesse list at eworm.de
Fri May 21 07:25:32 UTC 2021

Maarten de Vries <maarten at de-vri.es> on Fri, 2021/05/21 09:11:
> On 21-05-2021 08:52, Christian Hesse wrote:
> > Christian Hesse <list at eworm.de> on Thu, 2021/05/20 23:05:  
> >> From: Christian Hesse <mail at eworm.de>
> >>
> >> A server can indicate a soft failure by returning 412 (Precondition
> >> Failed). Only a warning (instead of error) message is logged and
> >> download is retried with next server, without counting server error.
> >>
> >> This http code can be used by servers that are not expected to be
> >> complete, for example when serving a local cache.  
> > I am open to changes, only important is that server error count does not
> > increase. So how about...
> >
> > * http code: We need something >= 400 for the code to behave correctly.
> >    Nothing fits perfectly... Do you think anything else matches better? Or
> >    should we use a proprietary code 9xx?
> > * log message: Is wording and severity ok?
> > * Where to document the behavior?  
> I would say that 412 is not the right status code to use for this, since 
> it already has a very specific different purpose.
> Another thing to consider is that normal server software won't know to 
> generate a different error code, so it will just return a 404 anyway. If 
> you need specific support from the server software, you are probably 
> better off with a custom header: X-Pacman-Expected-Failure or something 
> along those lines. Then you don't have to violate the HTTP standard to 
> get the desired behavior.

Great idea... I will have a look at this.

> Although from a user perspective it would probably be simpler to put 
> this information in the pacman.conf than to configure their HTTP server.

What do you think this should look like?

To give some background: There's pacredir [0][1] which tries to re-distribute
database and package files for local network. Depending on whether or not the
file is available it returns a temporary redirect (307) with location or not
found (currently 404).
I want to update that to send another http code or - even better as you
suggested - add a http header to indicate the expected failure.

[0] https://archlinux.org/packages/community/x86_64/pacredir/
[1] https://github.com/eworm-de/pacredir
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/20210521/a84653c3/attachment-0001.sig>

More information about the pacman-dev mailing list