From: Christopher Zimmermann Subject: Re: relayd: Keep Content-Length in response to HEAD request To: millert@openbsd.org, tech@openbsd.org Date: Thu, 18 Jul 2024 20:36:41 +0200 On Mon, Jul 01, 2024 at 12:48:12AM +0200, Jörg Sonnenberger wrote: >On 6/30/24 3:42 PM, Stuart Henderson wrote: >> >>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. I totally agree: RFC 9110 9.3.2: > However, a server MAY omit header fields for which a value is > determined only while generating the content. Relayd doas not generaty content. It has the Content-length header readily available. Is there any good reason to drop the Content-length header from HEAD responses? According to the commit message and comment it was removed because it would kind of lie about the content length: Commit message: > relay_read_http: strip out Content-Length if we strip the body too > We should not forward Content-Length if the body is not also > forwarded. Comment: > Strip Content-Length header from HEAD responses since there is no > actual payload in the response. I very much suspect, this was done under the assumption that a Content-length header in a HEAD response was wrong. millert@, is there any good reason to keep this quirk for HEAD responses? Christopher