rpc: implement websockets with github.com/gorilla/websocket (#19866)
* rpc: implement websockets with github.com/gorilla/websocket This change makes package rpc use the github.com/gorilla/websocket package for WebSockets instead of golang.org/x/net/websocket. The new library is more robust and supports all WebSocket features including continuation frames. There are new tests for two issues with the previously-used library: - TestWebsocketClientPing checks handling of Ping frames. - TestWebsocketLargeCall checks whether the request size limit is applied correctly. * rpc: raise HTTP/WebSocket request size limit to 5MB * rpc: remove default origin for client connections The client used to put the local hostname into the Origin header because the server wanted an origin to accept the connection, but that's silly: Origin is for browsers/websites. The nobody would whitelist a particular hostname. Now that the server doesn't need Origin anymore, don't bother setting one for clients. Users who need an origin can use DialWebsocket to create a client with arbitrary origin if needed. * vendor: put golang.org/x/net/websocket back * rpc: don't set Origin header for empty (default) origin * rpc: add HTTP status code to handshake error This makes it easier to debug failing connections. * ethstats: use github.com/gorilla/websocket * rpc: fix lint
Showing
- ethstats/ethstats.go 18 additions, 18 deletionsethstats/ethstats.go
- rpc/client.go 2 additions, 3 deletionsrpc/client.go
- rpc/http.go 1 addition, 1 deletionrpc/http.go
- rpc/ipc_unix.go 1 addition, 1 deletionrpc/ipc_unix.go
- rpc/json.go 11 additions, 6 deletionsrpc/json.go
- rpc/websocket.go 68 additions, 131 deletionsrpc/websocket.go
- rpc/websocket_test.go 228 additions, 15 deletionsrpc/websocket_test.go
- vendor/github.com/gorilla/websocket/AUTHORS 9 additions, 0 deletionsvendor/github.com/gorilla/websocket/AUTHORS
- vendor/github.com/gorilla/websocket/LICENSE 22 additions, 0 deletionsvendor/github.com/gorilla/websocket/LICENSE
- vendor/github.com/gorilla/websocket/README.md 64 additions, 0 deletionsvendor/github.com/gorilla/websocket/README.md
- vendor/github.com/gorilla/websocket/client.go 395 additions, 0 deletionsvendor/github.com/gorilla/websocket/client.go
- vendor/github.com/gorilla/websocket/client_clone.go 16 additions, 0 deletionsvendor/github.com/gorilla/websocket/client_clone.go
- vendor/github.com/gorilla/websocket/client_clone_legacy.go 38 additions, 0 deletionsvendor/github.com/gorilla/websocket/client_clone_legacy.go
- vendor/github.com/gorilla/websocket/compression.go 148 additions, 0 deletionsvendor/github.com/gorilla/websocket/compression.go
- vendor/github.com/gorilla/websocket/conn.go 1163 additions, 0 deletionsvendor/github.com/gorilla/websocket/conn.go
- vendor/github.com/gorilla/websocket/conn_write.go 15 additions, 0 deletionsvendor/github.com/gorilla/websocket/conn_write.go
- vendor/github.com/gorilla/websocket/conn_write_legacy.go 18 additions, 0 deletionsvendor/github.com/gorilla/websocket/conn_write_legacy.go
- vendor/github.com/gorilla/websocket/doc.go 227 additions, 0 deletionsvendor/github.com/gorilla/websocket/doc.go
- vendor/github.com/gorilla/websocket/go.mod 1 addition, 0 deletionsvendor/github.com/gorilla/websocket/go.mod
- vendor/github.com/gorilla/websocket/go.sum 2 additions, 0 deletionsvendor/github.com/gorilla/websocket/go.sum
Loading
Please register or sign in to comment