UserPreferences

PutDeleteFaq


Here are common questions and their answers about how the HTTP methods PUT and DELETE work or where they are supported on servers and from clients with respect to the Atom protocol.

How do I know if my server supports PUT/DELETE?

If your server, or service provider, allows CGIs, server modules, or server pages (PHP), then it supports PUT and DELETE.

PHP versions prior to 4.3 do not support PUT/DELETE.

For reference, in CGIs the request method is in the REQUEST_METHOD environment variable.

A list of server and client toolkits that support PUT/DELETE is found in PutDeleteSupport.

I have a URL '/image/kitten.jpg', can it support PUT/DELETE?

You can't necessarily PUT or DELETE, or POST for that matter, to arbitrary locations on the server. Atom editable resources must be at URL locations where a CGI, server module, or server page can respond to them.

What do you mean by "at a URL location where it can be responded to"?

When you access resources on a web server, some of those accesses are served by the web server internally (static resources, like the home page and images), and some are served by programs that run on the server (CGIs, server modules, or server pages).

Some Atom publishing systems will use "a single location" with URL query parameters to identify which resources are being served, like this:

http://example.com/~user/atom.cgi?entry=42

Other Atom publishing systems will use a "URL space" that use additional URL path segments, like this:

http://example.com/~user/atom.cgi/entries/42

CGIs, server modules, and server pages support both forms of URLs and Atom publishing system developers will choose either form that makes writing their system easier or more user friendly.

For reference, in CGIs the first form of URL location is available in the QUERY_STRING environment variable and the second form is available in the PATH_INFO environment variable.

Can I use URL rewriting to provide "clean" URLs to map to a CGI?

Yes. Atom encourages rewrite both because [WWW]Cool URIs don't change, and because it gives a more uniform URI space on the server. With rewrite, you don't have to serve some resources with querystrings (http://example.com/~user/atom.cgi?entry=42) and others without (http://example.com/~user/images/cat.jpg). More on rewrite: [WWW]for Apache and [WWW]for ASP.NET on IIS.

Doesn't allowing PUT mean the user can create arbitrary resources in my Atom system?

No. The URL locations, what can be stored there, and how they get accessed in the future are fully controlled by the Atom publishing system.

Do I need to use or know WebDAV to use PUT/DELETE?

No. PUT and DELETE are standard HTTP methods defined in [WWW]RFC2616. WebDAV ([WWW]RFC2518) adds additional methods beyond those in RFC2616, for supporting things like metadata (properties), moving and copying resources on the server, and locking. It is desired that Atom be upward compatible with WebDAV, but not require WebDAV knowledge to implement or use.

The misconception of needing WebDAV for PUT/DELETE may be related to how Apache 2.0 provides PUT/DELETE for static resources. In order to enable PUT/DELETE on static resources, the mod_dav module must be available and the "Dav On" directive must be specified for the resource. This has nothing to do with supporting PUT/DELETE through CGI-like methods, however. [RyanTomayko, RefactorOk]

Is Atom upward compatible with WebDAV?

We're not sure, a thorough analysis hasn't been done yet.

From a server perspective it is believed that as long as a WebDAV-based Atom publishing system outputs the proper Atom URL endpoint links (EditURI) then the server can provide additional WebDAV services to clients that can use them.

From a client perspective, WebDAV clients cannot be used with arbitrary Atom publishing systems.

What do I do if I want to restrict who can PUT/DELETE resources?

This question isn't specific to PUT/DELETE, it applies to all web services irrespective of POST or PUT/DELETE.

An Atom publishing system can offer access controls. An Atom publishing system that uses WebDAV may use WebDAV's support for Access Control Lists when they become available.

What is "PUT to create"?

In the [WWW]Atom API draft the only supported method for creating new resources in the server is POST to the PostURI (POST-to-create). PUT-to-create would be an alternative method for creating resources on the server, by allowing the user or client to select a URL name for the resource to be created, like images, file downloads, or other "static like" files. Wikis and blosxom-like systems could also use PUT-to-create.

Support for either or both POST-to-create or PUT-to-create would be up to the Atom publishing system. It has been suggested that POST-to-create could provide a "name hint" field for the final path segment of a URL to simulate a PUT-to-create. PaceNonEntryResources proposes support for PUT-to-create for non-entry resources, which are more likely to need or be simpler with user specified names.

Can I use the OPTIONS method to see if PUT/DELETE are supported?

Some servers (including Apache) do not call CGI programs for the OPTIONS method (by default?), so it would require additional configuration privileges to change the list of supported methods returned by OPTIONS.

Apache server modules can respond to OPTIONS methods.

"...HTTP/1.1 does not require that OPTIONS responses be truthful." -- [WWW]Roy Fielding

Within Atom, if you are provided an EditURI you take that as an indication that PUT/DELETE are supported on that URI.

Outside of Atom, if you want to use PUT/DELETE you should try it. If it is not supported you will receive a 405 (Method Not Allowed) status.

The ApacheWeek article on using PUT sounds really difficult, what gives?

The [WWW]ApacheWeek article is talking about configuring Apache to support PUT on arbitrary URL locations. This is not what Atom publishing systems do. Atom publishing systems provide a URL space of their own that supports POST, PUT, and DELETE on URLs served by the Atom publishing system.