diff --git a/client.go b/client.go index 815b0ca5..dbca164a 100644 --- a/client.go +++ b/client.go @@ -399,7 +399,7 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } } - if resp.StatusCode != 101 || + if resp.StatusCode != http.StatusSwitchingProtocols || !tokenListContainsValue(resp.Header, "Upgrade", "websocket") || !tokenListContainsValue(resp.Header, "Connection", "upgrade") || resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) { diff --git a/proxy.go b/proxy.go index 80f55d1e..b6af21f9 100644 --- a/proxy.go +++ b/proxy.go @@ -75,7 +75,7 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) return nil, err } - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { if err := conn.Close(); err != nil { log.Printf("httpProxyDialer: failed to close connection: %v", err) }