# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure (now replaced by GOINSECURE).

[!net] skip
[!exec:git] skip

env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off

! go get -d vcs-test.golang.org/insecure/go/insecure
stderr 'redirected .* to insecure URL'

# insecure host
env GOINSECURE=vcs-test.golang.org
go clean -modcache
go get -d vcs-test.golang.org/insecure/go/insecure

# insecure glob host
env GOINSECURE=*.golang.org
go clean -modcache
go get -d vcs-test.golang.org/insecure/go/insecure

# insecure multiple host
env GOINSECURE=somewhere-else.com,*.golang.org
go clean -modcache
go get -d vcs-test.golang.org/insecure/go/insecure

# different insecure host does not fetch
env GOINSECURE=somewhere-else.com
go clean -modcache
! go get -d vcs-test.golang.org/insecure/go/insecure
stderr 'redirected .* to insecure URL'
