Mailing List Archive

Header names case sensitivity
Hi there,

I've originally posted an issue in the GitHub repository, but was kindly
reminded that it's not the place to have this kind of discussion. I'm sorry
about that.

https://github.com/varnishcache/varnish-cache/issues/3883

To summarize briefly, I'm wondering if we can use header names in lowercase
or mixed-case in VCL (or both).

I can see some VCL code (for example the output of `varnishd -x builtin`)
with header names in lowercase and some in mixed-case, but I suspect that
it doesn't really matter and that both cases are supported in the same way.
I wish I could get a confirmation before putting all my header names in
lowercases without fear of breaking something.

In the GitHub issue Dridi said

> VCL was historically designed when HTTP/1 was the only player in town and
case sensitivity of the header names is enforced at the h2 protocol level.

I'm not sure if this means that regardless of the protocol used (1.0, 1.1,
or 2) at the request level the headers are already normalized in lowercase
internally and mixed-case keywords are still there for backward
compatibility.

Thanks for your help here.

--
Jérémy Lecour :
https://jeremy.lecour.fr - http://twitter.com/jlecour
Re: Header names case sensitivity [ In reply to ]
--------
Jérémy Lecour writes:

> To summarize briefly, I'm wondering if we can use header names in lowercase
> or mixed-case in VCL (or both).

As far as I know, we always treat header names as case insensitive in Varnish.

I think what dridi was referring to is that H2 insist they be lower-case,
on the wire, but our code takes care of that.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Header names case sensitivity [ In reply to ]
On Tue, Dec 13, 2022 at 10:29 PM Poul-Henning Kamp <phk@phk.freebsd.dk>
wrote:
> Jérémy Lecour writes:
>
> > To summarize briefly, I'm wondering if we can use header names in
lowercase
> > or mixed-case in VCL (or both).
>
> As far as I know, we always treat header names as case insensitive in
Varnish.
>
> I think what dridi was referring to is that H2 insist they be lower-case,
> on the wire, but our code takes care of that.

Thanks for the clarification.
I'll do some verification.

I also wonder if changing the casing of headers produced by Varnish
(X-Varnish …) might break some implementation in the willd.

--
Jérémy Lecour :
https://jeremy.lecour.fr - http://twitter.com/jlecour
Re: Header names case sensitivity [ In reply to ]
--------
Jérémy Lecour writes:

> I also wonder if changing the casing of headers produced by Varnish
> (X-Varnish ...) might break some implementation in the willd.

It should not, but yeah, not everybody reads RFCs recreationally...

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Header names case sensitivity [ In reply to ]
On Wed, Dec 14, 2022 at 10:56 AM Poul-Henning Kamp <phk@phk.freebsd.dk>
wrote:
> not everybody reads RFCs recreationally...

What ?? I'm shocked ! :D

I spent 2 hours last night reading parts of the RFC9110 about HTTP and I've
learnt a lot about HTTP headers.

For example, the "X-" prefix for non-standard headers has been deprecated
since 2012.
It was a good idea in theory but proven to be counter productive, based on
the long running experimentation in email and SIP (and HTTP).

For Varnish I guess we're stuck with the X- prefix since it became a
de-facto standard.

--
Jérémy Lecour :
https://jeremy.lecour.fr - http://twitter.com/jlecour
Re: Header names case sensitivity [ In reply to ]
On Wed, Dec 14, 2022 at 10:05 AM Jérémy Lecour <jeremy.lecour@gmail.com> wrote:
>
> On Wed, Dec 14, 2022 at 10:56 AM Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> > not everybody reads RFCs recreationally...
>
> What ?? I'm shocked ! :D
>
> I spent 2 hours last night reading parts of the RFC9110 about HTTP and I've learnt a lot about HTTP headers.
>
> For example, the "X-" prefix for non-standard headers has been deprecated since 2012.
> It was a good idea in theory but proven to be counter productive, based on the long running experimentation in email and SIP (and HTTP).
>
> For Varnish I guess we're stuck with the X- prefix since it became a de-facto standard.

We can always rename X-Varnish to something else but we'd need a good
reason to break existing setups.

On the other hand you have the ability to rename the header in VCL and
have access to the req.xid and bereq.xid variables to build your own
transaction tracking header.

Cheers
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc