summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/http2/h2i/h2i.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-02-02 09:32:00 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-02-02 09:32:00 -0500
commit701d1ab638b23c24877fc41824add66232446676 (patch)
treeec120c88d38ac9d38d9eabdd3270b52bb6ac9d96 /vendor/golang.org/x/net/http2/h2i/h2i.go
parentca3211bc04f6dea34e8168217182637d1419f998 (diff)
downloadchat-701d1ab638b23c24877fc41824add66232446676.tar.gz
chat-701d1ab638b23c24877fc41824add66232446676.tar.bz2
chat-701d1ab638b23c24877fc41824add66232446676.zip
Updating server dependancies (#5249)
Diffstat (limited to 'vendor/golang.org/x/net/http2/h2i/h2i.go')
-rw-r--r--vendor/golang.org/x/net/http2/h2i/h2i.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/golang.org/x/net/http2/h2i/h2i.go b/vendor/golang.org/x/net/http2/h2i/h2i.go
index 228edf8a4..76c778711 100644
--- a/vendor/golang.org/x/net/http2/h2i/h2i.go
+++ b/vendor/golang.org/x/net/http2/h2i/h2i.go
@@ -88,6 +88,14 @@ func withPort(host string) string {
return host
}
+// withoutPort strips the port from addr if present.
+func withoutPort(addr string) string {
+ if h, _, err := net.SplitHostPort(addr); err == nil {
+ return h
+ }
+ return addr
+}
+
// h2i is the app's state.
type h2i struct {
host string
@@ -134,7 +142,7 @@ func main() {
func (app *h2i) Main() error {
cfg := &tls.Config{
- ServerName: app.host,
+ ServerName: withoutPort(app.host),
NextProtos: strings.Split(*flagNextProto, ","),
InsecureSkipVerify: *flagInsecure,
}
@@ -473,7 +481,7 @@ func (app *h2i) encodeHeaders(req *http.Request) []byte {
host = req.URL.Host
}
- path := req.URL.Path
+ path := req.RequestURI
if path == "" {
path = "/"
}