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

Only change `%20` to `+` for application/x-www-form-urlencoded #2658

Closed
dmethvin opened this Issue Oct 18, 2015 · 3 comments

Comments

Projects
None yet
5 participants
@dmethvin
Member

dmethvin commented Oct 18, 2015

This resurrects trac-3400 which has the argument for the change. Currently we always change encoded spaces (%20) to the plus sign (+) in jQuery.param(). That is only correct behavior for posted form data, but not other cases. The conversion should be moved to jQuery.ajax() and only be done when the method is POST.

@jaubourg

This comment has been minimized.

Show comment
Hide comment
@jaubourg

jaubourg Oct 18, 2015

Member

The conversion should be moved to jQuery.ajax() and only be done when the method is POST has a body.

Member

jaubourg commented Oct 18, 2015

The conversion should be moved to jQuery.ajax() and only be done when the method is POST has a body.

@gibson042

This comment has been minimized.

Show comment
Hide comment
@gibson042

gibson042 Oct 18, 2015

Member

Note that form submission only converts spaces to plus signs in application/x-www-form-urlencoded encoding, which is used by HTTP(S) GET and POST logic. Note also that the de-coding algorithm explicitly replaces plus signs with spaces immediately before unescaping percent-escapes, which means that it treats + and %20 identically. So if we can't limit conversion specifically to application/x-www-form-urlencoded, a percent-encoding jQuery.param() would be a very reasonable approximation.

Member

gibson042 commented Oct 18, 2015

Note that form submission only converts spaces to plus signs in application/x-www-form-urlencoded encoding, which is used by HTTP(S) GET and POST logic. Note also that the de-coding algorithm explicitly replaces plus signs with spaces immediately before unescaping percent-escapes, which means that it treats + and %20 identically. So if we can't limit conversion specifically to application/x-www-form-urlencoded, a percent-encoding jQuery.param() would be a very reasonable approximation.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Oct 19, 2015

Member

Now that you've done all the hard work and set me straight on the details I will grab this ticket. Thanks!

Member

dmethvin commented Oct 19, 2015

Now that you've done all the hard work and set me straight on the details I will grab this ticket. Thanks!

@dmethvin dmethvin self-assigned this Oct 19, 2015

dmethvin added a commit to dmethvin/jquery that referenced this issue Oct 22, 2015

@mgol mgol added this to the 3.0.0 milestone Oct 26, 2015

@dmethvin dmethvin closed this in 70605c8 Nov 2, 2015

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.