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/url: QueryEscape() doesn't escape tilde #47379

Closed
alive opened this issue Jul 24, 2021 · 3 comments
Closed

net/url: QueryEscape() doesn't escape tilde #47379

alive opened this issue Jul 24, 2021 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@alive
Copy link

alive commented Jul 24, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16.6 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

see go version

What did you do?

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

What did you expect to see?

I expected to see the tilda characters converted to their URL escaped values: %7E.

What did you see instead?

The tilda characters were not converted.

According to this: https://jkorpela.fi/tilde.html tildas are no long a character that must be encoded. However, I think they still should be for safety, or at least there should be an option to encode them. Chrome browser, for example, still encodes tildas in the body of a post request, which is where my use case lies.

@seankhliao
Copy link
Member

That page refers to an obsoleted RFC

From the current RFC 3986 Section 2.3:

For consistency, percent-encoded octets in the ranges of ALPHA
(%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E),
underscore (%5F), or tilde (%7E) should not be created by URI
producers and, when found in a URI, should be decoded to their
corresponding unreserved characters by URI normalizers.

What specific usecase requires an escaped tilde?

@seankhliao seankhliao changed the title net/url: QueryEscape() Tilda (~) not encoded into %7E net/url: QueryEscape() doesn't escape tilde Jul 24, 2021
@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 24, 2021
@alive
Copy link
Author

alive commented Jul 29, 2021

that section of the RFC refers to URI only, not post body data, correct?
in my specific case, I'm trying to send an http post request to a website and the tilda character present in the post data not being encoded caused a bug.
Chrome,firefox,etc all encode '~' in the body of a post request, so I think Go should consider doing that as well.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jun 12, 2022
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants