-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Bryan C. Mills
committed
Sep 12, 2019
1 parent
54b7afb
commit 9a44023
Showing
5 changed files
with
166 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[!net] skip | ||
|
||
env GO111MODULE=on | ||
env GOSUMDB=off | ||
env GOPROXY=direct | ||
|
||
# Server responses should be truncated to some reasonable number of lines. | ||
# (For now, exactly eight.) | ||
! go list -m vcs-test.golang.org/auth/ormanylines@latest | ||
stderr '\tserver response:\n(.|\n)*\tline 8\n\t\[Truncated: too many lines.\]$' | ||
|
||
# Server responses should be truncated to some reasonable number of characters. | ||
! go list -m vcs-test.golang.org/auth/oronelongline@latest | ||
! stderr 'blah{40}' | ||
stderr '\tserver response: \[Truncated: too long\.\]$' | ||
|
||
# Responses from servers using the 'mod' protocol should be propagated. | ||
! go list -m vcs-test.golang.org/go/modauth404@latest | ||
stderr '\tserver response: File\? What file\?' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,13 @@ env GOPATH=$WORK/gopath1 | |
# With a file-based proxy with an empty checksum directory, | ||
# downloading a new module should fail, even if a subsequent | ||
# proxy contains a more complete mirror of the sum database. | ||
# | ||
# TODO(bcmills): The error message here is a bit redundant. | ||
# It comes from the sumweb package, which isn't yet producing structured errors. | ||
[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org | ||
[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org | ||
! go get -d golang.org/x/[email protected] | ||
stderr '^verifying golang.org/x/text.*: Not Found' | ||
stderr '^verifying golang.org/x/text@v0.3.2: golang.org/x/[email protected]: reading file://.*/sumdb/sum.golang.org/lookup/golang.org/x/[email protected]: (no such file or directory|.*cannot find the file specified.*)' | ||
|
||
# If the proxy does not claim to support the database, | ||
# checksum verification should fall through to the next proxy, | ||
|