]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: ignore paths on CONNECT requests in ServeMux
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 25 Apr 2012 19:46:16 +0000 (12:46 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 25 Apr 2012 19:46:16 +0000 (12:46 -0700)
Fixes #3538

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/6117058

src/pkg/net/http/server.go

index 924ffd348156e030a98e227ec4bb5691761af46e..00daef434cc85e85a00b7af9599721bafb84dc3f 100644 (file)
@@ -917,11 +917,13 @@ func (mux *ServeMux) handler(r *Request) Handler {
 // ServeHTTP dispatches the request to the handler whose
 // pattern most closely matches the request URL.
 func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request) {
-       // Clean path to canonical form and redirect.
-       if p := cleanPath(r.URL.Path); p != r.URL.Path {
-               w.Header().Set("Location", p)
-               w.WriteHeader(StatusMovedPermanently)
-               return
+       if r.Method != "CONNECT" {
+               // Clean path to canonical form and redirect.
+               if p := cleanPath(r.URL.Path); p != r.URL.Path {
+                       w.Header().Set("Location", p)
+                       w.WriteHeader(StatusMovedPermanently)
+                       return
+               }
        }
        mux.handler(r).ServeHTTP(w, r)
 }