]> Cypherpunks repositories - gostls13.git/commit
net/http: redirect host-based patterns to trailing slash
authorTerin Stock <terinjokes@gmail.com>
Mon, 18 Dec 2017 23:17:02 +0000 (15:17 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 11 Jan 2018 00:05:49 +0000 (00:05 +0000)
commit936b6bfde1b1956a2deb8947e2db3c423b9edf14
treeec5f9c6cac5dc7408d559e9bf882436816df07f3
parentbb4356dbfd03343bef39746f9937e57c93453e97
net/http: redirect host-based patterns to trailing slash

Handlers can be registered for specific hosts by specifying the host as
part of the mux pattern. If a trailing slash route is registered for
these host-based patterns, shouldRedirect should indicate that
a redirect is required.

This change modifies shouldRedirect to also take the host of the
request, and now considers host-based patterns while determining if
a request should be redirected.

Fixes #23183
Change-Id: If8753e130d5d877acdc55344833e3b289bbed2b4
Reviewed-on: https://go-review.googlesource.com/84695
Reviewed-by: Kunpei Sakai <namusyaka@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/serve_test.go
src/net/http/server.go