-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
We "need" a way to create an Http2Session from a socket - Server-side #46152
Comments
As stated by documentation about At the moment the socket is created by the underlying |
This would require a new API which would be quite a bit of work to test and develop. I recommend that we invest some effort in implementing HTTP/3. Having said this, I'll be ok to review a PR with this new API implemented. @jasnell wdyt? |
Grazie per la risposta @mcollina & @marco-ippolito :) From an API design point of view, how would you envision this? Knowing that my ultimate goal is to be able to create a HTTP/2 listener on an existing TCP socket, essentially applying the
|
I would probably do a |
I wonder how feasible that is. There are likely security considerations that need to be taken into account. HTTP/2 is not nearly as transport-agnostic as HTTP/1 is. For example, HTTP/2 prohibits TLS renegotiation but you can probably circumvent that (intentionally or unwittingly) when you create a session from an arbitrary TLS socket. |
The
To me, this sounds more like you want to have |
I am completely open to any API design that would allow us to achieve our business objective. Which at the end of the day has to do with firewall traversals for establishing a gRPC (hence, HTTP2/) connection between two apps and do that by re-using an established TCP connection.
Indeed. Although not sure if this needs to be enforced in some way, or should just be a warning in the documentation. A part of me would think that if someone were to meddle with low-level things like these, they should be responsible for any "collateral damages" they cause. |
This is client->server traffic? Are you using e.g. HTTP/1.1 CONNECT to punch through your firewall and then want to initiate HTTP/2 over that connection? |
No, we establish a HTTP/2 connection directly because it's for gRPC. App A calls app B. But app B is behind a firewall. So, first app A sets up a TCP listener, then app B establishes a TCP connection to that port (this is outbound), then we start a HTTP/2 server in app B using the established connection. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
still relevant here |
There doesn't seem to be consensus though, neither on the how nor the if. Might as well close it if it's not going to happen. |
@bnoordhuis @ItalyPaleAle, this issue seems to lack an implementation volunteer. I think it's possible to make this functionality happen but it's a somewhat extensive amount of work with very limited interested by collaborators. Let's close and revisit if somebody volunteers to implement this. If this is a feature that Microsoft needs, they might be willing to sponsor its development. |
Sounds reasonable. I'll go ahead and close it then. @ItalyPaleAle fyi, I take on contracting work. Email is in my profile. |
Thanks, I'll see what I can do. Just a note that this is needed by Dapr, a CNCF project, not Microsoft! |
Is there a referencing issue we can track? |
@mcollina Yes: dapr/dapr#5392 The POC was done but it was stalled due to lack of support in some (most?) gRPC SDKs. The Node.js one is blocked by this issue. |
FYI - I was also in need of the ability to create a session from a socket, in my case a client tls socket - post preface check, with read buffer unshifted back to the socket. I managed to solve my problem using |
What is the problem this feature will solve?
This issue is named after a 6-years old issue: #16256
The original issue asked for a way to be able to create a
http2.Http2Session
from anet.Socket
, providing an example of code like this (which currently doesn't work):The original issue was specifically about problems on the HTTP2 client, and it was fixed by introducing a
createConnection
handler inhttp2.connect
.However, we still cannot create a
Http2Session
object from an existingnet.Socket
, and this is a problem for our use case in the server.In our case, we have an app A that needs to invoke app B. App B is behind a firewall so cannot create a listener. How we've solved this problem (in Go) is to create an ephemeral server on app A, so that app A can create a TCP socket to that, and then start a HTTP/2 server (in this case, for gRPC) on top of the existing TCP socket.
What is the feature you are proposing to solve the problem?
We are looking for a way to implement the same solution in Node.js, and a possible solution seems to be in the ability to create
Http2Session
objects to then serve streams on.Alternatively, it would be nice to have a way to "start" a HTTP/2 server without using
.listen()
, but rather on a specific TCP socket.What alternatives have you considered?
It doesn't look like there's an alternative in Node.js today, sans re-implementing our own HTTP/2 stack.
The text was updated successfully, but these errors were encountered: