Index | Thread | Search

From:
Jörg Sonnenberger <joerg@bec.de>
Subject:
Re: relayd: Keep Content-Length in response to HEAD request
To:
millert@openbsd.org, tech@openbsd.org
Date:
Mon, 1 Jul 2024 00:48:12 +0200

Download raw body.

Thread
On 6/30/24 3:42 PM, Stuart Henderson wrote:
> On 2024/06/29 19:16, Christopher Zimmermann wrote:
>> Hi,
>>
>> responses to HEAD requests SHOULD return the same headers a GET request
>> would yield (https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.2).
>>
>> Therefore the Content-Length header should not be stripped from responses to
>> HEAD requests.
>>
>> This bit me when relaying traffic between restic and a restic-rest-server.
>> Restic gets confused by the missing Content-Length: header and complains
>> about a "negative content length" when checking for the presence of /config.
> 
> There's also this, though:
> 
> "However, a server MAY omit header fields for which a value is
> determined only while generating the content"
> 
> and specifically goes on to talk about HEAD.

The intention here is to allow the server to avoid expensive 
computations of the body when it is going to be thrown away anyway.
A proxy certainly should not make any decisions in this regard and
just preserve content-length if it is present.

Joerg