W3C home > Mailing lists > Public > ietf-http-wg@w3.org > January to March 2014

clarify PUT failure response status (400, 404 or 405) when resource handler doesn't exists

From: Best <http@florianbest.de>
Date: Mon, 10 Feb 2014 19:17:03 +0000
Message-ID: <52F92355.2070105@florianbest.de>
To: ietf-http-wg-request@w3.org
Hello httpbis,

The following sentence in RFC 2616 is not detailed enough to understand fully:

RFC 2616 Section 9.6 - PUT
…"If the resource could not be created or modified with the Request-URI, an appropriate
   error response SHOULD be given that reflects the nature of the problem."…

De-facto many HTTP servers are responding with the status code 404 Not Found when applying PUT to a resource which doesn't have a "handling controller / cannot be routed internally".
"handling controller" is implementation detail and means: a GET request to that resource is 404.

The nature of PUT is to create a resource if it doesn't exists!
→ 404 Not Found can never be an accurate status code (because of course the resouce doesn't exists, it should be created)

I guess the proper response status code would be 405 Method Not allowed?
→ but this is also strange because it implies that there is already a resource?

Otherwise I would use 400 Bad Request but this is to generic and not understandable by a client.

Or maybe is 404 really correct? It can mean: "There is no resource" or also "There is no representation of the resource".

In my opinion this should be clarified in the RFC.
Received on Monday, 10 February 2014 20:20:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:24 UTC