{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/21955","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/21955/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/21955/comments","events_url":"https://api.github.com/repos/golang/go/issues/21955/events","html_url":"https://github.com/golang/go/issues/21955","id":259343510,"number":21955,"title":"net/http: DefaultServeMux incorrectly redirect (301) to path if path includes `%2F%2F`","user":{"login":"kalbasit","id":87115,"avatar_url":"https://avatars2.githubusercontent.com/u/87115?v=4","gravatar_id":"","url":"https://api.github.com/users/kalbasit","html_url":"https://github.com/kalbasit","followers_url":"https://api.github.com/users/kalbasit/followers","following_url":"https://api.github.com/users/kalbasit/following{/other_user}","gists_url":"https://api.github.com/users/kalbasit/gists{/gist_id}","starred_url":"https://api.github.com/users/kalbasit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalbasit/subscriptions","organizations_url":"https://api.github.com/users/kalbasit/orgs","repos_url":"https://api.github.com/users/kalbasit/repos","events_url":"https://api.github.com/users/kalbasit/events{/privacy}","received_events_url":"https://api.github.com/users/kalbasit/received_events","type":"User","site_admin":false},"labels":[{"id":373399998,"url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"namusyaka","id":309329,"avatar_url":"https://avatars0.githubusercontent.com/u/309329?v=4","gravatar_id":"","url":"https://api.github.com/users/namusyaka","html_url":"https://github.com/namusyaka","followers_url":"https://api.github.com/users/namusyaka/followers","following_url":"https://api.github.com/users/namusyaka/following{/other_user}","gists_url":"https://api.github.com/users/namusyaka/gists{/gist_id}","starred_url":"https://api.github.com/users/namusyaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namusyaka/subscriptions","organizations_url":"https://api.github.com/users/namusyaka/orgs","repos_url":"https://api.github.com/users/namusyaka/repos","events_url":"https://api.github.com/users/namusyaka/events{/privacy}","received_events_url":"https://api.github.com/users/namusyaka/received_events","type":"User","site_admin":false},"assignees":[{"login":"namusyaka","id":309329,"avatar_url":"https://avatars0.githubusercontent.com/u/309329?v=4","gravatar_id":"","url":"https://api.github.com/users/namusyaka","html_url":"https://github.com/namusyaka","followers_url":"https://api.github.com/users/namusyaka/followers","following_url":"https://api.github.com/users/namusyaka/following{/other_user}","gists_url":"https://api.github.com/users/namusyaka/gists{/gist_id}","starred_url":"https://api.github.com/users/namusyaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namusyaka/subscriptions","organizations_url":"https://api.github.com/users/namusyaka/orgs","repos_url":"https://api.github.com/users/namusyaka/repos","events_url":"https://api.github.com/users/namusyaka/events{/privacy}","received_events_url":"https://api.github.com/users/namusyaka/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/6","html_url":"https://github.com/golang/go/milestone/6","labels_url":"https://api.github.com/repos/golang/go/milestones/6/labels","id":1055141,"number":6,"title":"Unplanned","description":"No plan to fix in any specific release.\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":1229,"closed_issues":996,"state":"open","created_at":"2015-04-06T20:47:19Z","updated_at":"2018-04-05T00:05:20Z","due_on":"2099-12-31T08:00:00Z","closed_at":null},"comments":5,"created_at":"2017-09-21T00:48:17Z","updated_at":"2018-04-05T19:55:57Z","closed_at":null,"author_association":"NONE","body":"### What version of Go are you using (`go version`)?\r\n`go version go1.9 linux/amd64`\r\n\r\n### Does this issue reproduce with the latest release?\r\nyes\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\n```\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"linux\"\r\nGOOS=\"linux\"\r\nGOPATH=\"/home/kalbasit/code/personal/base\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/lib/go\"\r\nGOTOOLDIR=\"/usr/lib/go/pkg/tool/linux_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"gcc\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build643957992=/tmp/go-build -gno-record-gcc-switches\"\r\nCXX=\"g++\"\r\nCGO_ENABLED=\"1\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\n```\r\n\r\n### What did you do?\r\n```\r\npackage main\r\n\r\nimport \"net/http\"\r\n\r\nfunc main() {\r\n\thttp.ListenAndServe(\":8878\", nil)\r\n}\r\n```\r\n\r\n```\r\ncurl 'http://localhost:8878/path:a%2F%2Fgoogle.com%2F'\r\n```\r\n\r\n### What did you expect to see?\r\n`404 page not found`\r\n\r\n### What did you see instead?\r\n`<a href=\"/path:a/google.com/\">Moved Permanently</a>.`\r\n\r\n**NOTE**: this does not happen if [alice](https://github.com/justinas/alice) was used instead of the `http.DefaultServeMux`"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/379057478","html_url":"https://github.com/golang/go/issues/21955#issuecomment-379057478","issue_url":"https://api.github.com/repos/golang/go/issues/21955","id":379057478,"user":{"login":"tombergan","id":13954200,"avatar_url":"https://avatars0.githubusercontent.com/u/13954200?v=4","gravatar_id":"","url":"https://api.github.com/users/tombergan","html_url":"https://github.com/tombergan","followers_url":"https://api.github.com/users/tombergan/followers","following_url":"https://api.github.com/users/tombergan/following{/other_user}","gists_url":"https://api.github.com/users/tombergan/gists{/gist_id}","starred_url":"https://api.github.com/users/tombergan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombergan/subscriptions","organizations_url":"https://api.github.com/users/tombergan/orgs","repos_url":"https://api.github.com/users/tombergan/repos","events_url":"https://api.github.com/users/tombergan/events{/privacy}","received_events_url":"https://api.github.com/users/tombergan/received_events","type":"User","site_admin":false},"created_at":"2018-04-05T19:55:57Z","updated_at":"2018-04-05T19:55:57Z","author_association":"CONTRIBUTOR","body":"I'm not sure if this actually a bug in the first place. The URL reported in the original comment is:\r\n\r\n    http://localhost:8878/path:a%2F%2Fgoogle.com%2F\r\n\r\nThe decoded path is:\r\n\r\n    /path:a//google.com/\r\n\r\nThat path clearly has a double slash and path.Clean translates double slashes to single slashes. Also see [here](https://play.golang.org/p/RIlcT7X9gZR). The godoc for ServerMuex.Handler says:\r\n\r\n    // If the path is not in its canonical form, the\r\n    // handler will be an internally-generated handler that redirects\r\n    // to the canonical path.\r\n\r\nIf there's an open question here, the question is around the definition of \"canonical path\". Does the canonical path convert double slashes to single slashes? If so, there's no bug. If not, there's a bug. AFAICT, this question is not answered anywhere. In net/http/server_tests.go, serverMuxTests does not have a case for double slashes, so I suspect this question hasn't come up until now."}}
{"actor":{"display_login":"tombergan"}}