-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
h2c server allows graceful shutdown #4907
Comments
@WeidiDeng That's good to know. We'll need to look into this. I appreciate you bringing it to our attention! Copying over 200 lines of code would be a bummer. But if there's no other way, maybe that's just what we'll have to do. |
Copying code is indeed such a chore. Alternatively, I can think of another way. h2c check condition is pretty easy to copy, but we cannot access the net.Conn after the hijack call. One way would be specify a http.Server.ConnContext to record the underlying net.Conn and extract the net.Conn. Using BaseContext and a custom listener is also an option, but I think that's an overkill. Besides this, h2c handler has another bug to fix (but that doesn't affect caddy that much, because caddy specific context key uses caddy's own), h2c handler won't extract the correct http.Server instance from the request itself, I'll push a pr upstream. This causes a number of issues 52868, 37089 |
Upstream pr has been submitted, I wonder how long that will take, since http2.Transport.DialTlsContext is stuck there for months. |
Yeah... I've been waiting for a long time for that one 😩 |
Awesome, thank you so much for helping with this @WeidiDeng |
Similar to websocket, h2c server internally upgrade the request and pass the resulting conn to http2 server to demux the stream to http handler.
Currently, h2c request, just like websocket, were left on their own. At least we can add ConfigureServer, which internally register graceful h2 shutdown on server shutdown.
If really wants to properly cleanup, perhaps just copy the h2c.go file and make some modifications. It's just 225 lines.
The text was updated successfully, but these errors were encountered: