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
WebSocketClient closes connection soon after handshake with some server implementations #27560
Comments
Maybe related to warmcat/libwebsockets#1435 |
Yeah, it's definitely related and it seems to be an intended behavior rather than a bug, as per the developer's response here: warmcat/libwebsockets@082f096#r30944340 The developer states that it's legal, however, I don't see anything in the RFC 6455 that speaks to this particular header form, so it's unclear whether libwebsocket is using a malformed header, or some servers are handling the header incorrectly. I personally think the |
Combining multiple headers is allowed by HTTP, it should be valid during the WebSocket handshake too:
That said, a potential solution for Godot |
I wasn't questioning the validity of combined headers, I was specifically questioning the use of a
If the websocket protocol, overrode this behavior, it would have stated this explicitly, and it does not, which is why I said the aforementioned header form should be avoided. |
That may very well be the case, the discussion should be moved upstream |
Can we get a fix for this before 3.2 please |
This bug is kind of tricky to fix, since the issue has already been raised in the master branch of libwebsocket (the offending library in this case), and the developer insists on keeping the current behavior, even though it doesn't play well with some servers. I personally don't agree with him, since, in my opinion, compatibility is king when it comes to web technologies, regardless of any intuitive justification. Nevertheless, @Faless has suggested that the libwebsocket version used by Godot, be downgraded to |
I couldn't find one, it seems to me someone has to hack the C library first. I suggest we downgrade to libwebosckets |
I hit this problem myself and there is a workaround: Use the LCCSCF_PIPELINE option on ssl_options when creating a connection and that will disable the "close," part of the Connection: header. |
Could you tell me where this "ssl_options" is located? I'm trying to find what can I do to make this connection work |
see warmcat/libwebsockets#1435, this was fixed more than three years ago. |
Wasn't the underlying websocket library changed (from libwebsocket) to wslay as well? |
Godot version:
3.1 stable
OS/device including version:
Ubuntu 18.04 LTS
Issue description:
When connecting to some weboscket servers, the client disconnects immediately after the handshake is complete (i.e. as soon as the server responds to our upgrade request). This, I suspect, is cause by the fact that a
Connection: close, Upgrade
header is sent in the upgrade request. I also suspect that this is caused by libwebsocket. Below shows the handshake as seen in wireshark.Steps to reproduce:
Use a WebSocketClient object to connect to one of the following websocket servers:
Note that some websocket servers appear to ignore the
close
field in the connection header. Below is a list of websocket servers that ignore theclose
field:Minimal reproduction project:
The following script could be attached to a root node to reproduced the issue, however I have also included a full project setup which can be tested.
ws_test.zip
The text was updated successfully, but these errors were encountered: