forked from mirror/websocket
return an error when Dialer.TLSClientConfig.NextProtos contains a protocol that is not http/1.1
This commit is contained in:
parent
27d91a9be5
commit
8a0b8d46a3
|
@ -9,6 +9,7 @@ import (
|
|||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
|
@ -185,6 +186,12 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
|||
return nil, nil, errMalformedURL
|
||||
}
|
||||
|
||||
for _, proto := range d.TLSClientConfig.NextProtos {
|
||||
if proto != "http/1.1" {
|
||||
return nil, nil, fmt.Errorf("protocol %q is currently not supported", proto)
|
||||
}
|
||||
}
|
||||
|
||||
req := &http.Request{
|
||||
Method: http.MethodGet,
|
||||
URL: u,
|
||||
|
|
Loading…
Reference in New Issue