You could wrap ServeMux with one that escapes // to /%2f (or use your own escaping mechanism) and then passes the request on to ServeMux. You would have to unescape the path in the handler or use a wrapper for that also.
On Tue, Feb 28, 2017 at 12:16 AM tsuna <[email protected]> wrote: > Hi there, > the code in > https://github.com/golang/go/blob/go1.8/src/net/http/server.go#L2197 is > canonicalizing the request paths such that if you get /foo//bar you get a > 301 redirect to /foo/bar. > > While this is generally what you want, I am dealing with an unfortunate > case where /foo//bar and /foo/bar are not the same resource (and lot’s > not argue about why) and I couldn’t find an easy way to circumvent this > behavior without completely replacing the ServeMux. Am I missing > something and there is a better way? > > I should specify also that my handler is just for the prefix /foo and > that I cannot explicitly register a handler for each possible path where > this problem exists under /foo. > > -- > Benoit "tsuna" Sigoure > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
