Skip to content

The curl sub-command should support --http2-prior-knowledge with "https" URLs#2342

Merged
jhump merged 3 commits intomainfrom
jh/buf-curl-http2-prior-knowledge
Aug 3, 2023
Merged

The curl sub-command should support --http2-prior-knowledge with "https" URLs#2342
jhump merged 3 commits intomainfrom
jh/buf-curl-http2-prior-knowledge

Conversation

@jhump
Copy link
Member

@jhump jhump commented Aug 2, 2023

Previously, buf curl would complain if you tried to use --http2-prior-knowledge with secure "https" URLs.

Now, the flag is accepted and the client will only use HTTP/2. This basically removes "http/1.1" from the set of supported protocols during ALPN, and if the server does not support ALPN (i.e. does not pick a protocol), it defaults to HTTP/2 (whereas it was previously defaulting to HTTP 1.1).

This can be used to work with secure servers that expect HTTP/2 but don't correctly implement ALPN to select "h2". This could be the case when using network load balancers that terminate TLS (layer 4, instead of layer 7).

I tested this locally against a server using the grpc-go runtime (it does not use "net/http" and only supports HTTP/2). I hacked the runtime so that it did not use ALPN during the TLS handshake. Without --http2-prior-knowledge, a buf curl command fails since it is sending an HTTP 1.1 request to a server expecting HTTP/2. But with the flag, the request succeeds.

@jhump jhump changed the title The curl sub-command should support for --http2-prior-knowledge with "https" URLs The curl sub-command should support --http2-prior-knowledge with "https" URLs Aug 3, 2023
@jhump jhump merged commit b0a2fd8 into main Aug 3, 2023
@jhump jhump deleted the jh/buf-curl-http2-prior-knowledge branch August 3, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants