[chore] Update gorilla/websocket (#3561)

The maintainers messed with the v1.5.2 tag which causes Go checksum
validation problems as the Go module proxy saw and recorded the original
hash.

This updates to 1.5.3 which doesn't have the issue.
This commit is contained in:
Daenney
2024-11-25 11:50:03 +01:00
committed by GitHub
parent ae1a98558a
commit 2ed409888b
22 changed files with 115 additions and 1081 deletions

View File

@ -11,14 +11,13 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptrace"
"net/url"
"strings"
"time"
"golang.org/x/net/proxy"
)
// ErrBadHandshake is returned when the server response to opening handshake is
@ -305,7 +304,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
return nil, nil, err
}
if proxyURL != nil {
dialer, err := proxy.FromURL(proxyURL, netDialerFunc(netDial))
dialer, err := proxy_FromURL(proxyURL, netDialerFunc(netDial))
if err != nil {
return nil, nil, err
}
@ -392,7 +391,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
}
}
if resp.StatusCode != http.StatusSwitchingProtocols ||
if resp.StatusCode != 101 ||
!tokenListContainsValue(resp.Header, "Upgrade", "websocket") ||
!tokenListContainsValue(resp.Header, "Connection", "upgrade") ||
resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) {
@ -401,7 +400,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
// debugging.
buf := make([]byte, 1024)
n, _ := io.ReadFull(resp.Body, buf)
resp.Body = io.NopCloser(bytes.NewReader(buf[:n]))
resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n]))
return nil, resp, ErrBadHandshake
}
@ -419,7 +418,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
break
}
resp.Body = io.NopCloser(bytes.NewReader([]byte{}))
resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol")
netConn.SetDeadline(time.Time{})
@ -429,7 +428,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
func cloneTLSConfig(cfg *tls.Config) *tls.Config {
if cfg == nil {
return &tls.Config{MinVersion: tls.VersionTLS12}
return &tls.Config{}
}
return cfg.Clone()
}