Skip to content
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 does not quote URL consistently like "protocol scheme" in returned errors #38421

Closed
as opened this issue Apr 13, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@as
Copy link
Contributor

as commented Apr 13, 2020

The HTTP client should quote the URL and protocol scheme consistently. Look at the result of this call to http.Get with an empty URL string:

fmt.Println(http.Get(""))
// <nil> Get : unsupported protocol scheme ""

I can't immediately see that there's an empty string in this output, I only see that the protocol is empty.

What did you expect to see?

<nil> Get "": unsupported protocol scheme ""

What did you see instead?

<nil> Get : unsupported protocol scheme ""

https://play.golang.org/p/ppBzVyfctb6

@smasher164 smasher164 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 14, 2020
@smasher164 smasher164 changed the title http: client: quote URL consistently like "protocol scheme" in returned errors net/http: client does not quote URL consistently like "protocol scheme" in returned errors Apr 14, 2020
@mlowicki
Copy link
Contributor

@as which version are you using? I've tested locally with go version go1.14.1 linux/arm and it looks fine:

<nil> Get "": unsupported protocol scheme ""

I've checked https://play.golang.org/p/ppBzVyfctb6 and I'm getting there:

<nil> Get "": unsupported protocol scheme ""
<nil> Get "example.com": unsupported protocol scheme ""
<nil> Get "ftp://example.com": unsupported protocol scheme "ftp"

@as
Copy link
Contributor Author

as commented Apr 20, 2020

The issue is not reproducible in the latest version. At the time of writing, the playground link successfully reproduced it (week ago). As of the latest version, it does not. Closing.

@as as closed this as completed Apr 20, 2020
@golang golang locked and limited conversation to collaborators Apr 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants