spacemonkeygo / openssl

OpenSSL bindings for Go
http://godoc.org/github.com/spacemonkeygo/openssl
Apache License 2.0
472 stars 236 forks source link

http2 enabling #70

Open yonderblue opened 7 years ago

yonderblue commented 7 years ago

I can't seem to get a server that is run with server := &http.Server{...}; server.Serve(theOpensslListener) to serve http2. I've tried setting TLSNextProto to nil and to call http2.ConfigureServer etc, which works when not going through openssl's listener. Any suggestions? Thanks!

zeebo commented 7 years ago

The go http2 implementation is heavily tied to using crypto/tls to read the ALNP business in the handshake unfortunately. You have to figure out a way to serve http2 over bare connections and handle wrapping the connections with our openssl library yourself. :(

I'll leave this open to track possibly making a helper in some package to make this easier.

yonderblue commented 5 years ago

Looks like this should be entirely possible by supporting on the Ctx in here the ability to set a callback to select the proto from the ones the client gives in ALPN, then once a conn is in hand from a listener, choose to do http2.Server.ServeConn or feed to a running http.Server's listener depending on what proto client chose on conn.

https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_alpn_select_cb.html