Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: ServeMux also eliminates repeating "/" #13639

Closed
egonelbre opened this issue Dec 16, 2015 · 3 comments

Comments

Projects
None yet
5 participants
@egonelbre
Copy link
Contributor

commented Dec 16, 2015

Just a documentation issue that - http.ServeMux (cleanPath) gets also rid of duplicate /-s. http.ServeMux already contains:

ServeMux also takes care of sanitizing the URL request path, redirecting any request containing . or .. elements to an equivalent .- and ..-free URL.

I'm not sure how to reword it nicely to include the case of empty path segments, hence I didn't make a CL. Here's shortest example:

package main
import ("fmt"; "net/http")
func main() {
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "%s", r.URL.Path)
    })
    http.ListenAndServe(":8001", nil)
}

/hello////world will redirect to /hello/world. From URI standpoint they are different and both valid (https://tools.ietf.org/html/rfc3986#section-3.3).

@bradfitz

This comment has been minimized.

Copy link
Member

commented Dec 16, 2015

Related: #11757

@rsc, I can try to document these but feel free to steal these two as I still consider you the ServeMux owner. I've never really worked on it.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 16, 2015

Thanks. I'll take these two.

@rsc rsc assigned rsc and unassigned bradfitz Dec 16, 2015

@gopherbot

This comment has been minimized.

Copy link

commented Dec 17, 2015

CL https://golang.org/cl/17955 mentions this issue.

@rsc rsc closed this in aaa0bc1 Dec 17, 2015

@golang golang locked and limited conversation to collaborators Dec 29, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.