mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc: don't set Origin header for empty (default) origin
This commit is contained in:
parent
61b12da21f
commit
bbfe6f9c17
2 changed files with 9 additions and 1 deletions
|
|
@ -141,7 +141,9 @@ func wsClientHeaders(endpoint, origin string) (string, http.Header, error) {
|
|||
return endpoint, nil, err
|
||||
}
|
||||
header := make(http.Header)
|
||||
if origin != "" {
|
||||
header.Add("origin", origin)
|
||||
}
|
||||
if endpointURL.User != nil {
|
||||
b64auth := base64.StdEncoding.EncodeToString([]byte(endpointURL.User.String()))
|
||||
header.Add("authorization", "Basic "+b64auth)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ func TestWebsocketOriginCheck(t *testing.T) {
|
|||
if err != websocket.ErrBadHandshake {
|
||||
t.Fatalf("wrong error for wrong origin: %q", err)
|
||||
}
|
||||
|
||||
client, err = DialWebsocket(context.Background(), wsURL, "")
|
||||
if err != nil {
|
||||
t.Fatal("error for empty origin")
|
||||
}
|
||||
client.Close()
|
||||
}
|
||||
|
||||
// This test checks whether calls exceeding the request size limit are rejected.
|
||||
|
|
|
|||
Loading…
Reference in a new issue