0

I am not sure whether this behavior is specific to any framework or not. I was on a rails project.
Consider the following request
http://localhost/some_path/some+value
Here some+value is parsed as it is. No encoding.
Now for the next request:
http://localhost/some_path?params=some+value
some+value was parsed as some value

My question is what are the reason for this behavior and does it compliance with rfc1738 and URL Standard

Community
  • 1
  • 1
Faruk Hossain
  • 567
  • 5
  • 9
  • "Parsed" where? Do you mean by the time it ends up in the `params` in the controller? – Matt Gibson Aug 01 '17 at 09:27
  • @MattGibson Yes exactly. – Faruk Hossain Aug 01 '17 at 09:28
  • 1
    Long story short: urls legacy. URL and Query params have to be encoded differently - more here https://stackoverflow.com/a/33939287/1904052 Now, rack is handling that for you so you can expect it to be like that on any framework that uses rack ('ensurance' here -> https://github.com/rack/rack/blob/ea9e7a570b7ffd8ac6845a9ebecdd7de0af6b0ca/test/spec_utils.rb#L44 ) – Afonso Tsukamoto Aug 01 '17 at 10:10

1 Answers1

0

The relevant spec for URIs is RFC 3986.

RFC 3986 does not mandate the structure of the query string. That depends essentially on how HTML forms work, and that's why "+" is special in the query string, but not anywhere else.

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98