Merge pull request #5034 from ZhuPeng/proxy-http2

Enable http2 support between proxy and member
This commit is contained in:
Xiang Li 2016-04-16 07:04:41 -07:00
commit f15b5aa4e6

View File

@ -19,6 +19,8 @@ import (
"net/http"
"strings"
"time"
"golang.org/x/net/http2"
)
const (
@ -42,6 +44,14 @@ type GetProxyURLs func() []string
// which will proxy requests to an etcd cluster.
// The handler will periodically update its view of the cluster.
func NewHandler(t *http.Transport, urlsFunc GetProxyURLs, failureWait time.Duration, refreshInterval time.Duration) http.Handler {
if t.TLSClientConfig != nil {
// Enable http2, see Issue 5033.
err := http2.ConfigureTransport(t)
if err != nil {
plog.Infof("Error enabling Transport HTTP/2 support: %v", err)
}
}
p := &reverseProxy{
director: newDirector(urlsFunc, failureWait, refreshInterval),
transport: t,