The OPTIONS Method

According to the HTTP specification (RFC 2616), the OPTIONS method is used to query the server about the communication abilities of a given resource or the whole server. A particular application of this method is finding the HTTP methods supported by the resource. In case of WebDAV, it can be used to determine if the resource supports WebDAV and if so which DAV compliance class it uses. Here is a sample OPTIONS request:
OPTIONS http://localhost/digestdav/ HTTP/1.1
Host: localhost
User-Agent: cadaver/0.22.3 neon/0.25.5
Connection: TE
TE: trailers

And its response is:

HTTP/1.1 200 OK
Date: Wed, 31 May 2006 05:59:34 GMT
Server: Apache/2.2.2 (FreeBSD) mod_ssl/2.2.2 \
  OpenSSL/0.9.7e-p1 DAV/2 SVN/1.3.1 mod_jk/1.2.15
DAV: 1,2
DAV: <http://apache.org/dav/propset/fs/1>
MS-Author-Via: DAV
Allow: OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND, \
  PROPPATCH,COPY,MOVE,LOCK,UNLOCK
Content-Length: 0
Content-Type: httpd/unix-directory

The header Allow shows that the WebDAV methods (PROPFIND, PROPPATCH, etc.) are supported. The DAV header shows that this resource supports Class 1 and Class 2 compliance. Class 1 must support all MUST requirements from RFC 2518. Class 2 includes all Class 1 requirements and supports the LOCK method, the <lockdiscovery> and the <supportedlock> properties and Timeout and Lock-Token request headers.



Иван Иванов 2006-06-23