]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/web: include snippets of plain-text server responses in error detail
authorBryan C. Mills <bcmills@google.com>
Mon, 5 Aug 2019 16:02:55 +0000 (12:02 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 12 Sep 2019 14:09:20 +0000 (14:09 +0000)
commit9a44023ce922407fe4e847400924e2b2980bd2c5
tree17cdcd977da1d59ba4212a410fe73c12187615e6
parent54b7afb4ef228a76d10d81c48445efbe2d6a1fa0
cmd/go/internal/web: include snippets of plain-text server responses in error detail

For the server response to be displayed, the response must be served
as type text/plain with charset us-ascii or utf-8, and must consist of
only graphic characters and whitespace.

We truncate the server response at the first blank line or after 8
lines or a fixed number of characters, and tab-indent (if multiple
lines) to ensure that the response is offset from ordinary go command
output.

Fixes #30748

Change-Id: I0bc1d734737e456e3251aee2252463b6355e8c97
Reviewed-on: https://go-review.googlesource.com/c/go/+/189783
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/web/api.go
src/cmd/go/internal/web/http.go
src/cmd/go/testdata/script/mod_auth.txt
src/cmd/go/testdata/script/mod_proxy_errors.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_sumdb_file_path.txt