LOCK http://localhost/digestdav/sample.txt HTTP/1.1 Host: localhost User-Agent: cadaver/0.22.3 neon/0.25.5 Connection: TE TE: trailers Content-Length: 145 Content-Type: application/xml Depth: 0 Authorization: Digest username="admin", realm="WebDAV Repository", nonce="Hm1VQ2AVBAA=13284a6fc4c39442df1bfbe5ef41d6175e539f1f", uri="http://localhost/digestdav/sample.txt", response="02d3842ddc77c7b70a383e3a2778fd2f", algorithm="MD5", cnonce="c457b3e9b00f54cbe6f736cffe7ccff4", nc=00000004, qop="auth" <?xml version="1.0" encoding="utf-8"?> <lockinfo xmlns=\'DAV:\'> <lockscope><exclusive/></lockscope> <locktype><write/></locktype> </lockinfo>
The root element of the request's body is < lockinfo> which contains additional information about the lock. The element <lockinfo> specifies if the lock is shared or exclusive and <locktype> specifies the access type of the lock. Currently the only lock type defined is write lock.
The response of the LOCK request will be:
HTTP/1.1 200 OK
Date: Sun, 04 Jun 2006 06:38:38 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
Authentication-Info:
rspauth="da918928831cd4ba65ed917c68e8ec30",
cnonce="c457b3e9b00f54cbe6f736cffe7ccff4",
nc=00000004, qop=auth
Lock-Token: <opaquelocktoken:a62549c1-94f3-da11-ab0d-00c09fda2406>
Content-Length: 371
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8"?>
<D:prop xmlns:D="DAV:">
<D:lockdiscovery>
<D:activelock>
<D:locktype><D:write/></D:locktype>
<D:lockscope><D:exclusive/></D:lockscope>
<D:depth>0</D:depth>
<D:timeout>Infinite</D:timeout>
<D:locktoken>
<D:href>
opaquelocktoken:a62549c1-94f3-da11-ab0d-00c09fda2406
</D:href>
</D:locktoken>
</D:activelock>
</D:lockdiscovery>
</D:prop>
The element <locktoken> is of great importance. It is used to identify the owner of the lock. If a client wants to modify a locked resource, they must provide the exact locktoken in the If header of their request. If the locktoken does not match request the request fails with 423 Locked response. The element <Timeout> contains the timeout of the lock in this case it is infinity, which is completely server specific - the client did not even set Timeout header of the request.
Иван Иванов 2006-06-23