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

Maarten de Vries maarten at de-vri.es
Fri May 21 07:11:45 UTC 2021


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.

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


Kind regards,

Maarten


More information about the pacman-dev mailing list