W3C home > Mailing lists > Public > ietf-http-wg@w3.org > July to September 2016

HTTP Content-Location header usage

From: Никита Пискунов <n.piskunov91@gmail.com>
Date: Wed, 21 Sep 2016 12:35:04 +0000
Message-Id: <CAGnWK0SnbuXk69jaWm8PY88G7pyVx1zKkY9Och6SApeVJjhQBw@mail.gmail.com>
To: ietf-http-wg@w3.org
Hello,
i've already posted my comment about ambiguous Content-Location header usage description here as a GitHub Issue. And I've also decided to raise the discussion via email.

So, my question is:

The RFC 5789 discribes the apropriate usage of Content-Location header in PATCH:

A response to this method is only cacheable if it contains explicit freshness information (such as an Expires header or "Cache-Control: max-age" directive) as well as the Content-Location header matching the Request-URI, indicating that the PATCH response body is a resource representation.
So, it means, that Content-Location header must appear only if the actual represantation is the part of response body for PATCH.

Also the usage of Content-Location is mentioned in another RFC 7231:

For a state-changing request like PUT (Section 4.3.4) or POST (Section 4.3.3), it implies that the server's response contains the new representation of that resource, thereby distinguishing it from representations that might only report about the action (e.g., "It worked!"). This allows authoring applications to update their local copies without the need for a subsequent GET request.
So, accordingly to this information in both RFCs, the apropriate usage of Content-Location with state-changing requests are following:
Content-Location must appear in response only if response-body contains the new resourse representation.

But, there is also an example in RFC 5789:

Successful PATCH response to existing text file:

HTTP/1.1 204 No Content
Content-Location: /file.txt
ETag: "e0023aa4f"

The 204 response code is used because the response does not carry a message body (which a response with the 200 code would have). Note that other success codes could be used as well.

Furthermore, the ETag response header field contains the ETag for the entity created by applying the PATCH, available at http://www.example.com/file.txt <http://www.example.com/file.txt>, as indicated by the Content-Location response header field.
How you can see, there is a Content-Location presented in response with 204 status code (No content). Ofcourse, this response doesn't contain any body as well as new resourse representation. This fact adds some ambiguity in Content-Location header description. What is the correct usage of this header?
Received on Saturday, 24 September 2016 21:02:39 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 24 September 2016 21:02:45 UTC