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"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
|
@ -185,6 +186,12 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||||
return nil, nil, errMalformedURL
|
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{
|
req := &http.Request{
|
||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
URL: u,
|
URL: u,
|
||||||
|
|
Loading…
Reference in New Issue