Apache + WebDAV メモ
enable_dav
httpd-2.4.34/modules/dav/main
enable_dav_fs
httpd-2.4.34/modules/dav/fs
enable_dav_lock
httpd-2.4.34/modules/dav/lock
--enable-dav
--enable-dav-fs
--enable-dav-lock
conf/extra/httpd-dav.conf
code:httpd.conf
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
DavLockDB "/Users/foo/opt/httpd-2.4.34/var/DavLock"
Alias /dav "/Users/foo/opt/httpd-2.4.34/dav"
<Directory "/Users/foo/opt/httpd-2.4.34/dav">
Dav On
AllowOverride none
Require all granted
</Directory>
code:text
HTTP/1.1 403 Forbidden
Date: Mon, 23 Jul 2018 06:59:04 GMT
Server: Apache/2.4.34 (Unix)
Content-Length: 220
Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>PROPFIND requests with a Depth of "infinity" are not allowed for /dav/.</p>
</body></html>
code:text
HTTP/1.1 207 Multi-Status
Date: Mon, 23 Jul 2018 07:01:07 GMT
Server: Apache/2.4.34 (Unix)
Content-Length: 1626
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
<D:href>/dav/</D:href>
<D:propstat>
<D:prop>
<lp1:resourcetype><D:collection/></lp1:resourcetype>
<lp1:creationdate>2018-07-23T06:29:05Z</lp1:creationdate>
<lp1:getlastmodified>Mon, 23 Jul 2018 06:29:05 GMT</lp1:getlastmodified>
<lp1:getetag>"60-571a4c3140e40"</lp1:getetag>
<D:supportedlock>
<D:lockentry>
<D:lockscope><D:exclusive/></D:lockscope>
<D:locktype><D:write/></D:locktype>
</D:lockentry>
<D:lockentry>
<D:lockscope><D:shared/></D:lockscope>
<D:locktype><D:write/></D:locktype>
</D:lockentry>
</D:supportedlock>
<D:lockdiscovery/>
<D:getcontenttype>httpd/unix-directory</D:getcontenttype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:href>/dav/hello.txt</D:href>
<D:propstat>
<D:prop>
<lp1:resourcetype/>
<lp1:creationdate>2018-07-23T06:29:12Z</lp1:creationdate>
<lp1:getcontentlength>6</lp1:getcontentlength>
<lp1:getlastmodified>Mon, 23 Jul 2018 06:29:12 GMT</lp1:getlastmodified>
<lp1:getetag>"6-571a4c37ede00"</lp1:getetag>
<lp2:executable>F</lp2:executable>
<D:supportedlock>
<D:lockentry>
<D:lockscope><D:exclusive/></D:lockscope>
<D:locktype><D:write/></D:locktype>
</D:lockentry>
<D:lockentry>
<D:lockscope><D:shared/></D:lockscope>
<D:locktype><D:write/></D:locktype>
</D:lockentry>
</D:supportedlock>
<D:lockdiscovery/>
<D:getcontenttype>text/plain</D:getcontenttype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
PUT
code:text
$ echo 'abcd.txt' > abcd.txt
HTTP/1.1 201 Created
Date: Mon, 23 Jul 2018 07:21:25 GMT
Server: Apache/2.4.34 (Unix)
Content-Length: 185
Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /dav/abcd.txt has been created.</p>
</body></html>
----
collection に対して行ってみる
lock 中のファイルに対して行ってみる
LOCK
code:text
HTTP/1.1 400 Bad Request
Date: Fri, 27 Jul 2018 07:02:28 GMT
Server: Apache/2.4.34 (Unix)
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
$ cat lock_req
<?xml version="1.0" encoding="utf-8" ?>
<D:lockinfo xmlns:D='DAV:'>
<D:lockscope><D:exclusive/></D:lockscope>
<D:locktype><D:write/></D:locktype>
<D:owner>hoge</D:owner>
</D:lockinfo>
HTTP/1.1 200 OK
Date: Fri, 27 Jul 2018 07:09:11 GMT
Server: Apache/2.4.34 (Unix)
Lock-Token: <opaquelocktoken:ea914ea0-cc44-49f6-8ddc-b8170c6dbb1a>
Content-Length: 422
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>infinity</D:depth>
<ns0:owner xmlns:ns0="DAV:">hoge</ns0:owner><D:timeout>Infinite</D:timeout>
<D:locktoken>
<D:href>opaquelocktoken:ea914ea0-cc44-49f6-8ddc-b8170c6dbb1a</D:href>
</D:locktoken>
</D:activelock>
</D:lockdiscovery>
</D:prop>
HTTP/1.1 423 Locked
Date: Fri, 27 Jul 2018 07:13:52 GMT
Server: Apache/2.4.34 (Unix)
Content-Length: 277
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>423 Locked</title>
</head><body>
<h1>Locked</h1>
<p>The requested resource is currently locked.
The lock must be released or proper identification
given before the method can be applied.</p>
</body></html>