-
Notifications
You must be signed in to change notification settings - Fork 134
Exporting Server.handleConn #69
Comments
+1 - I would very much like this exposed for the very same reasons (The ability to serve h2 where TLS has already been handled by other mechanisms, and the negotiated protocol has been determined to be h2 or h2-14). Apart from exposing the ability to start a h2 connection, it would also make it "easier" to have the HTTP server eat accepted net.Conns, rather than having to make a "fake" net.Listener. |
cc @xiang90 |
I have made this change in my fork https://github.com/joushou/http2 (branch "exposehandleconn"). However, the branch "exposeserve" holds what I think is a cleaner solution, if we want to do something like this for both http1 and http2. Instead of HandleConn, one could have a NewH2Conn, that sets up a serverConn and returns it. serverConn would then have Serve exposed. One would then be able to expose Serve on HTTP/1.1 connections, allowing for a similar functionality on both protocols, depending on whether one calls NewH2Conn or NewH1Conn (probably named differently). I'd like some feedback on the general idea before I submit a pull request, unless people would rather just see the code. (For the record: The master branch, including import adjustments of course, include exposeserve and functions fine for me in serve2d) |
Any update on this @bradfitz or @bmizerany? |
Sorry, I haven't done it yet. |
This repo just moved into the official Go repo. See https://github.com/bradfitz/http2/blob/master/README for the move details. File new bugs at: https://github.com/golang/go/issues/new?title=x/net/http2:+ Closing this bug, but please copy it to the main repo if still relevant or desired. Thanks! |
@bradfitz Will do. Thank you for your effort in providing us HTTP/2.0 support! |
Server.handleConn
is the minimum required to implement anhttp2
server outsidenet/http
, say to implementh2c
:I have another selfish reason for that. I've built a connection multiplexer that sniffs connections to multiplex them. Using that, I can run net/rpc, gRPC, and HTTP1.1 on the same port. However, I can't do that for HTTP2 because I have to wrap the actual connection in a
cmux
connection. So, the "fake" connection is not a*tls.Conn
andTLSNextProto
handlers would never be called for HTTP2 flows.Would you please consider exporting this method?
Just in case, I confirm that using the snippet above I can serve
h2
(i.e., chrome) and gRPC/TLS traffic on the same port.The text was updated successfully, but these errors were encountered: