From c2aee3c0bf7b4199d71970df5557b28b53afae4f Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Thu, 17 Jan 2013 18:50:49 +0800 Subject: [PATCH] cmd/godoc: when redirecting don't clear query string so that http://golang.org/pkg/runtime?m=all works. R=bradfitz CC=golang-dev https://golang.org/cl/7094046 --- src/cmd/godoc/godoc.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index 12148ec1cd..54cd8ef2d5 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -656,7 +656,9 @@ func redirect(w http.ResponseWriter, r *http.Request) (redirected bool) { canonical += "/" } if r.URL.Path != canonical { - http.Redirect(w, r, canonical, http.StatusMovedPermanently) + url := *r.URL + url.Path = canonical + http.Redirect(w, r, url.String(), http.StatusMovedPermanently) redirected = true } return @@ -668,7 +670,9 @@ func redirectFile(w http.ResponseWriter, r *http.Request) (redirected bool) { c = c[:len(c)-1] } if r.URL.Path != c { - http.Redirect(w, r, c, http.StatusMovedPermanently) + url := *r.URL + url.Path = c + http.Redirect(w, r, url.String(), http.StatusMovedPermanently) redirected = true } return -- 2.48.1