Skip to content
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

Fixes to JSON-RPC and WebSocket clients #1189

Merged
merged 4 commits into from
Apr 12, 2024
Merged

Fixes to JSON-RPC and WebSocket clients #1189

merged 4 commits into from
Apr 12, 2024

Conversation

belmarca
Copy link
Collaborator

Some JSON-RPC servers do not accept Content-Type: application/json-rpc. The programmer must now specialize their code for their own uses.

The WebSocket client was wrongly terminating when the server did not respond with a Sec-Websocket-Version header. Our logic was flawed and we now fail when it is present. See https://datatracker.ietf.org/doc/html/rfc6455#section-4.4.

@belmarca belmarca requested a review from fare March 25, 2024 17:26
Copy link

netlify bot commented Mar 25, 2024

Deploy Preview for elastic-ritchie-8f47f9 ready!

Name Link
🔨 Latest commit 8957428
🔍 Latest deploy log https://app.netlify.com/sites/elastic-ritchie-8f47f9/deploys/6619b7a6e5f8bc00088806e9
😎 Deploy Preview https://deploy-preview-1189--elastic-ritchie-8f47f9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@fare
Copy link
Collaborator

fare commented Apr 4, 2024

The tests fail:

*** ERROR IN "net/websocket/client.ss"@76.26-76.43 [IOError]: bad server response; unsupported websocket version
--- irritants: websocket-connect ("Sec-Websocket-Version" . "13") 

belmarca and others added 4 commits April 12, 2024 21:15
Some servers do not accept "application/json-rpc" as Content-Type.
Programmers can specialize for their own uses.
Per the spec (https://datatracker.ietf.org/doc/html/rfc6455#section-4.4)
the server only sends back a Sec-Websocket-Version header if it supports
versions other than the one requested by the client. Thus it was an
error to fail on a missing header. We now fail on a present header since
our current implementation only supports v13.
@fare
Copy link
Collaborator

fare commented Apr 12, 2024

I rebased the branch, added the docs I asked for, and fixed the server.

@fare fare enabled auto-merge (squash) April 12, 2024 22:41
@fare fare merged commit 05b056f into master Apr 12, 2024
12 checks passed
@fare fare deleted the fix-jsonrpc-ws branch April 12, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants