HTTP POST prarameters order / REST urls

Posted by pq on Stack Overflow See other posts from Stack Overflow or by pq
Published on 2010-04-17T02:16:20Z Indexed on 2010/04/17 2:23 UTC
Read the original article Hit count: 352

Filed under:
|
|
|
|

Let's say that I'm uploading a large file via a POST HTTP request.

Let's also say that I have another parameter (other than the file) that names the resource which the file is updating.

The resource cannot be not part of the URL the way you can do it with REST (e.g. foo.com/bar/123). Let's say this is due to a combination of technical and political reasons.

The server needs to ignore the file if the resource name is invalid or, say, the IP address and/or the logged in user are not authorized to update the resource.

Looks like, if this POST came from an HTML form that contains the resource name first and file field second, for most (all?) browsers, this order is preserved in the POST request. But it would be naive to fully rely on that, no?

In other words the order of HTTP parameters is insignificant and a client is free to construct the POST in any order. Isn't that true?

Which means that, at least in theory, the server may end up storing the whole large file before it can deny the request.

It seems to me that this is a clear case where RESTful urls have an advantage, since you don't have to look at the POST content to perform certain authorization/error checking on the request.

Do you agree? What are your thoughts, experiences?

© Stack Overflow or respective owner

Related posts about http

Related posts about post