Closed
Description
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).