cmd/godoc: allow golang.google.cn as a valid host

Change-Id: I8a585ad64f389f57800afe99824ae249c9f80340
Reviewed-on: https://go-review.googlesource.com/88677
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
Andrew Bonventre 2018-01-19 22:12:17 -05:00
parent af2bfe26b6
commit 99037e3760
1 changed files with 3 additions and 2 deletions

View File

@ -34,7 +34,8 @@ var enforceHosts = false // set true in production on app engine
// hostEnforcerHandler redirects requests to "http://foo.golang.org/bar" // hostEnforcerHandler redirects requests to "http://foo.golang.org/bar"
// to "https://golang.org/bar". // to "https://golang.org/bar".
// It permits requests to the host "godoc-test.golang.org" for testing. // It permits requests to the host "godoc-test.golang.org" for testing and
// golang.google.cn for Chinese users.
type hostEnforcerHandler struct { type hostEnforcerHandler struct {
h http.Handler h http.Handler
} }
@ -60,7 +61,7 @@ func (h hostEnforcerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (h hostEnforcerHandler) validHost(host string) bool { func (h hostEnforcerHandler) validHost(host string) bool {
switch strings.ToLower(host) { switch strings.ToLower(host) {
case "golang.org", "godoc-test.golang.org": case "golang.org", "godoc-test.golang.org", "golang.google.cn":
return true return true
} }
return false return false