-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support connection upgrade using rack.hijack
partial hijack.
#2914
Comments
I made a minimal (non-web socket) server just to see what I could trigger: app = lambda do |env|
p env
callback = proc do |stream|
binding.irb
end
[101, {'rack.hijack' => callback, 'upgrade' => 'websocket'}, []]
end I noticed that even for an incoming connection with |
Re the above, were you using a TLSv1.3 connection? Could you try it forced to TLSv1.2? |
@MSP-Greg I believe I was just using plain HTTP, no TLS. But I can double check. |
Could something have used port 443? I'll check the code, but that error only happens when an http connection is made to a server setup to use only SSL clients, and also with TLSv1.3 as the negotiated protocol? |
https://github.com/ioquatix/puma-switching-protocols I was trying to get this to work. I can't seem to get the |
If I change the status code from Lines 580 to 595 in f598876
|
Oh, great, let me try it. |
I've created rack/rack#1954 as a proposal for how we can solve protocol upgrades with a shared semantic between HTTP/1 and HTTP/2. While we still need to do protocol specific things, actually handling the streaming is a bit easier with shared understand of "this request wants to use the following protocol, and this response will use that protocol". |
HTTP/1 and HTTP/2 have distinct mechanisms supporting websocket. HTTP/1 requires I would like to know if you are interested in exploring a model which I've been using in In HTTP/1, if you see In HTTP/2, if you see In both cases, you will need to negotiate the response headers appropriately according to the specific RFCs for the protocol you are handling. Puma itself would need to support this mapping however it could leave What do you think of such an approach? Can you suggest something better? |
A long time ago, I knew the differences between the draft WebSocket specs/recs. I'm interested in this, but I need a big refresh on the spec. Does WebSocket exist with HTTP/3? Given that it is a different protocol (UDP), not sure... |
There are two specs: HTTP/1 uses
Yes, but the stream is handled by HTTP/2+ multiplexing. The underlying transport doesn't matter to the websocket protocol itself (much). |
In my testing, Can this issue be closed? |
Yes, thanks for checking! |
It would be nice if Puma can support WebSockets, even if it was limited to one WebSocket per thread. Allocation 100 or 1000 threads per instance isn't a bad model for some use cases.
I've been playing around with this, but can't get it to work.
I have a sample server:
This returns a response which looks like this:
I have a proposal to support a better upgrade mechanism, but in theory, this should be sufficient. However, I get the following error:
I'm guessing something is wrong at the protocol level.
rack.hijack
never seems to be called. I wonder if Puma is trying to buffer all the input?rack.hijack
probably expects streaming input.The text was updated successfully, but these errors were encountered: