forked from mystiq/dex
Merge pull request #825 from ericchiang/http2
storage/kubernetes: enable HTTP/2 support
This commit is contained in:
commit
920f6fb5cd
1 changed files with 12 additions and 1 deletions
|
@ -25,6 +25,7 @@ import (
|
||||||
"github.com/ghodss/yaml"
|
"github.com/ghodss/yaml"
|
||||||
"github.com/gtank/cryptopasta"
|
"github.com/gtank/cryptopasta"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
"golang.org/x/net/http2"
|
||||||
|
|
||||||
"github.com/coreos/dex/storage"
|
"github.com/coreos/dex/storage"
|
||||||
"github.com/coreos/dex/storage/kubernetes/k8sapi"
|
"github.com/coreos/dex/storage/kubernetes/k8sapi"
|
||||||
|
@ -285,7 +286,8 @@ func newClient(cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace string, l
|
||||||
tlsConfig.Certificates = []tls.Certificate{cert}
|
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||||
}
|
}
|
||||||
|
|
||||||
var t http.RoundTripper = &http.Transport{
|
var t http.RoundTripper
|
||||||
|
httpTransport := &http.Transport{
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
Dial: (&net.Dialer{
|
Dial: (&net.Dialer{
|
||||||
Timeout: 30 * time.Second,
|
Timeout: 30 * time.Second,
|
||||||
|
@ -296,6 +298,15 @@ func newClient(cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace string, l
|
||||||
ExpectContinueTimeout: 1 * time.Second,
|
ExpectContinueTimeout: 1 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we set a custom TLS client config we have to explicitly
|
||||||
|
// enable HTTP/2.
|
||||||
|
//
|
||||||
|
// https://github.com/golang/go/blob/go1.7.4/src/net/http/transport.go#L200-L206
|
||||||
|
if err := http2.ConfigureTransport(httpTransport); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
t = httpTransport
|
||||||
|
|
||||||
if user.Token != "" {
|
if user.Token != "" {
|
||||||
t = transport{
|
t = transport{
|
||||||
updateReq: func(r *http.Request) {
|
updateReq: func(r *http.Request) {
|
||||||
|
|
Loading…
Reference in a new issue