An HTTP POST request with content type "application/x-www-form-urlencoded" has parameters encoded in the body in the form of key=value pairs, concatenated with the & delimiter. Example from http://www.opencalais.com/HTTPexamples:
POST /enlighten/rest HTTP/1.1
Host: api.opencalais.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
licenseID=string&content=string¶msXML=string
I take it when a user fills out an ordinary POST form on a web page, the browser is not bound to any particular order of the key=value pairs when submitting the request.
However, does the HTTP protocol say anything about this order as the request is passed on by intermediate servers? Do any servers such as Apache, nginx, IIS rearrange the parameters? If such a POST request is sent to a server can one expect that the back-end server code (say PHP, Perl, Java) has access to the identical HTTP request body as sent?
Browsers are supposed to send application/x-www-form-urlencoded data in tree order. The spec doesn't make this very clear, but you can tease it out if you look carefully. See x-www-form-urlencoded-encoding-algorithm and Constructing the form data set. The decoding section also calls the output a "sorted list of name-value pairs".
So yes, a well-behaved proxy should preserve the order of form entries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With