how to prevent net/http to clean slash in URL.Path

187 views
Skip to first unread message

Feng Liyuan

unread,
Dec 10, 2013, 1:08:15 AM12/10/13
to golan...@googlegroups.com

If a request to my server with a url path '/a//b.txt', net/http will clean it and redirect it to '/a/b.txt'
I looked up in golang source code at http://golang.org/src/pkg/net/http/server.go?s=42132:42200#L1443
How to disable the feature?

--
冯立元

Dave Cheney

unread,
Dec 10, 2013, 2:09:04 AM12/10/13
to Feng Liyuan, golang-nuts
If you were able to disable this, how would that help ?

RFC2616 and friends say that

GET /a/b.txt

and

GET /a//b.txt

refer to the same resource.
> --
> 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 golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Brad Fitzpatrick

unread,
Dec 10, 2013, 3:48:59 AM12/10/13
to Feng Liyuan, golang-nuts
You don't have to use http.ServeMux.  You can use another mux or write your own.



--
Reply all
Reply to author
Forward
0 new messages