Skip to content

Curl does not lowercase header names for HTTP/2 and HTTP/3 #4400

@tunetheweb

Description

@tunetheweb

Curl does not currently lower case HTTP header names as required by HTTP/2 and HTTP/3. The lower-level libraries that curl uses (nghttp for HTTP/2 and ngtcp2/quiche for HTTP/3) do lower case the header names, but it does mean for some of the output, before the lower library is invoked, curl can show upper case header names which could be confusing.

While this may seem somewhat pedantic, I still see some developers who are caught by surprised by this more strict requirement for HTTP/2 and HTTP/3 so would prefer curl to not display this as it does currently.

For example:
HTTP/3 output with incorrect HTTP header names

As I see it, we can do one of three things here:

  1. Ignore it. It's just a display issue and at the end of the day curl behaves correctly when it goes to actually send the message. Lowercasing the header names may have a slight performance cost and it will be done anyway in lower level library so pointless doing it twice. We have bigger fish to fry so let's close this issue.
  2. Correct this when printing the output for HTTP/2 and HTTP/3, which is relatively low risk as not really changing anything except the output.
  3. Correct the actual header name when using HTTP/2 or HTTP/3, which does alter the actual header name, so may be higher risk than 2, but which the lower level library should be doing anyway so maybe not that much of a risk.

I've taken a stab at option 3 here: master...bazzadp:lowercase_h2_h3_headernames.

I'd appreciate your thoughts on this and if it's worth submitting this as a pull request?

It's my first potential commit to curl, and my C is a little rusty, so please be kind :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions