From 2f08bd96a0f291450c0f8cd41741fa475309cfc4 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 17 Dec 2015 00:37:09 -0500 Subject: [PATCH] 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 --- src/cmd/go/http.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cmd/go/http.go b/src/cmd/go/http.go index d558dcd0b9a..13d5c467065 100644 --- a/src/cmd/go/http.go +++ b/src/cmd/go/http.go @@ -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") }