From: Russ Cox Date: Thu, 14 Mar 2024 13:55:01 +0000 (+0000) Subject: Revert "net/http: remove superfluous newline on redirects" X-Git-Tag: go1.23rc1~896 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=303aa921c59017b521c9f077a8bd6687a2d81465;p=gostls13.git Revert "net/http: remove superfluous newline on redirects" This reverts commit 2b58355ef624239dbe32185dc8dfc9d1074615c6. Reason for revert: This breaks tons of tests for no real reason. Change-Id: I89773f48cf983c0b6346e46c37a0ebbe2620e3b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/571675 Auto-Submit: Russ Cox Reviewed-by: Than McIntosh LUCI-TryBot-Result: Go LUCI --- diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 9df6ab426c..1012e44b68 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -2712,7 +2712,7 @@ func TestRedirectContentTypeAndBody(t *testing.T) { wantCT string wantBody string }{ - {MethodGet, nil, "text/html; charset=utf-8", "Found.\n"}, + {MethodGet, nil, "text/html; charset=utf-8", "Found.\n\n"}, {MethodHead, nil, "text/html; charset=utf-8", ""}, {MethodPost, nil, "", ""}, {MethodDelete, nil, "", ""}, diff --git a/src/net/http/server.go b/src/net/http/server.go index d0e4dc69e5..99c6d4fd0a 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -2287,7 +2287,7 @@ func Redirect(w ResponseWriter, r *Request, url string, code int) { // Shouldn't send the body for POST or HEAD; that leaves GET. if !hadCT && r.Method == "GET" { - body := "" + StatusText(code) + "." + body := "" + StatusText(code) + ".\n" fmt.Fprintln(w, body) } }