Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: x/net/http2/h2c: allow to disable http upgrade in h2c #68729

Open
xieyuschen opened this issue Aug 5, 2024 · 6 comments · May be fixed by golang/net#219
Open

proposal: x/net/http2/h2c: allow to disable http upgrade in h2c #68729

xieyuschen opened this issue Aug 5, 2024 · 6 comments · May be fixed by golang/net#219
Labels
Milestone

Comments

@xieyuschen
Copy link
Contributor

Proposal Details

changes

I add an option DisableH2CUpgrade to allow server to ignore the upgrading headers from the clients, it satisfies the bahavior mentioned in rfc7230 section 6.7

A server MAY ignore a received Upgrade
header field if it wishes to continue using the current protocol on
that connection.

So after the change, if DisableH2CUpgrade is specified, the server will use http/2 to serve http/2 requests while using http1.1 for http1.1 requests.

motivation

The H2C smuggle is verbose for a server behind some proxies. As the proxy is not controlled by the service maintainers, and it does need h2c for faster internal communication among servers, the prior knowledge way is enough in such scenarios.

This PR supports this feature by adding a new option, which is backward compatible as well.

@gabyhelp
Copy link

gabyhelp commented Aug 5, 2024

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@seankhliao seankhliao changed the title http2/h2c: allow to disable http upgrade in h2c x/net/http2/h2c: allow to disable http upgrade in h2c Aug 5, 2024
@gopherbot gopherbot added this to the Unreleased milestone Aug 5, 2024
@seankhliao
Copy link
Member

I'm not sure if any more work will be done on x/net/http2 as #67816 looks like it's likely to be accepted and explicitly drops support for upgrades.

@seankhliao seankhliao changed the title x/net/http2/h2c: allow to disable http upgrade in h2c proposal: x/net/http2/h2c: allow to disable http upgrade in h2c Aug 5, 2024
@ianlancetaylor ianlancetaylor moved this to Incoming in Proposals Aug 5, 2024
@ianlancetaylor
Copy link
Contributor

CC @neild @bradfitz

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/602716 mentions this issue: http2/h2c: allow to disable http upgrade in h2c

@xieyuschen
Copy link
Contributor Author

I'm not sure if any more work will be done on x/net/http2 as #67816 looks like it's likely to be accepted and explicitly drops support for upgrades.

#67816 supposed to support h2c with prior knowledge only into the standard library, I quite appreciate the idea because the upgrading mechanism is complex with many issues while hasn't been widely adapted according to RFC9113#3.1.

But regard on the proposal/pr here, I feel like it could be recognised as an improvement for existing h2c package to allow users use prior knowledge way only.

It's nice if it's accept as an intermediate step in h2c until the h2c with prior knowledge enters the stdlib and go team deprecates the package golang.org/x/net/http2/h2c.

@xieyuschen
Copy link
Contributor Author

CC @neild @bradfitz

Hi @neild @bradfitz could i know your idea about this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

Successfully merging a pull request may close this issue.

5 participants