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
Closed

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

egonelbre opened this issue Dec 16, 2015 · 3 comments

Comments

@egonelbre
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

rsc commented Dec 16, 2015

Thanks. I'll take these two.

@rsc rsc assigned rsc and unassigned bradfitz Dec 16, 2015
@gopherbot
Copy link

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

@rsc rsc closed this as completed in aaa0bc1 Dec 17, 2015
@golang golang locked and limited conversation to collaborators Dec 29, 2016
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants