Closed
Description
Over in #25192 (comment), @AGWA makes the suggestion to add to net/http a standard Handler wrapper to allow semicolons for people who want to opt into that. The function would be something like:
func AllowQuerySemicolons(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.RawQuery != "" {
r2 := new(http.Request)
*r2 = *r
r2.URL = new(url.URL)
*r2.URL = *r.URL
r2.URL.RawQuery = strings.ReplaceAll(r.URL.RawQuery, ";", "&")
h.ServeHTTP(w, r2)
} else {
h.ServeHTTP(w, r)
}
})
}
It seems like a nice way to reduce the pain of the semicolon change itself in #25192. We should consider adding it for Go 1.17 (even though we are in the freeze).