-
Notifications
You must be signed in to change notification settings - Fork 351
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
Adds h2c support #1868
Adds h2c support #1868
Conversation
b7a5587
to
b019978
Compare
👍 |
From my side great first step to support h2c as a server handler! |
d3103d1
to
0d9432d
Compare
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
0d9432d
to
f2b780b
Compare
any update about h2c ? |
@tsingson I think we should wait for golang/net#139 being merged and released, if not it's not reasonable to have h2c support in Go. |
thanks for update. |
func (h *h2cHandler) Shutdown(ctx context.Context) error { | ||
serr := h.s1.Shutdown(ctx) | ||
|
||
timer := time.NewTicker(500 * time.Millisecond) | ||
defer timer.Stop() | ||
for { | ||
n := atomic.LoadInt64(&h.conns) | ||
log.Debugf("h2c shutdown: %d connections", n) | ||
|
||
if n == 0 { | ||
return serr | ||
} | ||
select { | ||
case <-ctx.Done(): | ||
return ctx.Err() | ||
case <-timer.C: | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just waiting for connections close. Proper shutdown should send goaway
- https://github.com/golang/net/blob/304cc91b19ae873219f3d0807c8533267629cf2e/http2/server.go#L232-L241
- https://github.com/golang/net/blob/304cc91b19ae873219f3d0807c8533267629cf2e/http2/server.go#L1384-L1394
(i.e. golang/go#26682 is not solved)
|
Closing in favour of #2480 |
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4).
The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues:
x/net/http2/h2c: support closure of all connections and graceful shutdown golang/go#26682Adds h2c support #1868 (review)See h2c package docs for details.
Signed-off-by: Alexander Yastrebov [email protected]