Commit 2f08bd96 authored by Russ Cox's avatar Russ Cox

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/17945Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent a227351b
......@@ -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")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment