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

Allan McRae allan at archlinux.org
Fri May 28 10:43:12 UTC 2021


On 28/5/21 7:07 pm, Christian Hesse wrote:
> 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
> 

OK...  so pacredir never checks for the latest database availability on
a mirror if there is a newer database on one of the hosts.  Does this
mean the "new" database on the hosts network could be long out of date,
but as long as it is newer than the local machine being updated, that is
what will be used?

The reason I am trying to figure this out is the approach in the bug
report only provides cache servers for packages, and not databases.  I'm
trying to understand why you would cache databases.

Allan


More information about the pacman-dev mailing list