1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:46:47 -07:00

cmd/go: for go get -insecure, do not fall back to HTTP for non-200 responses

Since we allow non-200 responses from HTTPS in normal operation,
it seems odd to reject them in -insecure operation.

Fixes #13037 (again).

Change-Id: Ie232f7544ab192addfad407525888db6b967befe
Reviewed-on: https://go-review.googlesource.com/17945
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2015-12-17 00:37:09 -05:00
parent a227351b62
commit 2f08bd96a0

View File

@ -83,14 +83,11 @@ func httpsOrHTTP(importPath string, security securityMode) (urlStr string, body
}
}
urlStr, res, err := fetch("https")
if err != nil || res.StatusCode != 200 {
if buildV && err != nil {
if err != nil {
if buildV {
log.Printf("https fetch failed: %v", err)
}
if security == insecure {
if buildV && res.StatusCode != 200 {
log.Printf("https fetch: status %s", res.Status)
}
closeBody(res)
urlStr, res, err = fetch("http")
}