-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.13.1 linux/amd64
Does this issue reproduce with the latest release?
Yes (and on play.golang.org)
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/bradley/.cache/go-build" GOENV="/home/bradley/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/bradley/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/linuxbrew/.linuxbrew/Cellar/go/1.13.1/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/linuxbrew/.linuxbrew/Cellar/go/1.13.1/libexec/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc-5" CXX="g++-5" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build417703076=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Try to make a HTTP request using a URL including authentication/user info:
package main
import (
"net/http"
"net/url"
)
func main() {
u, err := url.Parse("http://bradleyjkemp:password@example.com")
if err != nil {
panic(err)
}
req := &http.Request{
Method: http.MethodGet,
URL: u,
}
http.DefaultClient.Do(req)
}
Runnable link: https://play.golang.org/p/ODXO4wBONJi
What did you expect to see?
Request is made successfully.
What did you see instead?
panic: assignment to entry in nil map
goroutine 1 [running]:
net/textproto.MIMEHeader.Set(...)
/usr/local/go/src/net/textproto/header.go:22
net/http.Header.Set(...)
/usr/local/go/src/net/http/header.go:37
net/http.send(0x85a510, 0x3aa6d0, 0x526ee0, 0x5bfa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/net/http/client.go:242 +0x3e0
net/http.(*Client).send(0x52d3a0, 0x85a510, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x5bfa, ...)
/usr/local/go/src/net/http/client.go:174 +0x120
net/http.(*Client).do(0x52d3a0, 0x85a510, 0x0, 0x0, 0x0, 0x5bfa)
/usr/local/go/src/net/http/client.go:641 +0x480
net/http.(*Client).Do(...)
/usr/local/go/src/net/http/client.go:509
main.main()
/tmp/sandbox697076589/prog.go:17 +0xe0
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.