-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: Client.Do() panics when URL includes HTTP basic auth #34878
Comments
Why are you not using https://golang.org/pkg/net/http/#NewRequest? That sets up many fields, so I'm assuming that you're forgetting to initialise some of them properly. |
Thank you for the report @bradleyjkemp! This a new panic in Go1.13 that stems from the fact that invoking Header.Clone() when Header is nil returns a nil map as we implemented in CL https://go-review.googlesource.com/c/go/+/188022 to solve the inconsistency behavior of Clone as per #33141, but we didn't go through all the call sites to check that the map was nil before assignment. The code posted up used to work in Go1.12 and before, now fails in Go1.13. @gopherbot please backport this issue to Go1.13. |
Backport issue(s) opened: #34881 (for 1.12), #34882 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
@mvdan you're right |
Change https://golang.org/cl/200977 mentions this issue: |
What version of Go are you using (
go version
)?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
OutputWhat did you do?
Try to make a HTTP request using a URL including authentication/user info:
Runnable link: https://play.golang.org/p/ODXO4wBONJi
What did you expect to see?
Request is made successfully.
What did you see instead?
The text was updated successfully, but these errors were encountered: