correctly read the hostname from a http.Request

This commit is contained in:
Marten Seemann
2016-12-19 00:12:25 +07:00
parent 14135798c0
commit c547ced3ce
3 changed files with 39 additions and 1 deletions

View File

@@ -145,7 +145,7 @@ func (c *Client) Do(req *http.Request) (*http.Response, error) {
if req.URL.Scheme != "https" {
return nil, errors.New("quic http2: unsupported scheme")
}
if authorityAddr("https", req.Host) != c.hostname {
if authorityAddr("https", hostnameFromRequest(req)) != c.hostname {
utils.Debugf("%s vs %s", req.Host, c.hostname)
return nil, errors.New("h2quic Client BUG: Do called for the wrong client")
}