README.rst
1********************
2nginx-dav-ext-module
3********************
4
5nginx_ WebDAV_ PROPFIND,OPTIONS,LOCK,UNLOCK support.
6
7.. contents::
8
9
10About
11=====
12
13The standard ngx_http_dav_module_ provides partial WebDAV_ implementation and
14only supports GET,HEAD,PUT,DELETE,MKCOL,COPY,MOVE methods.
15
16For full WebDAV_ support in nginx_ you need to enable the standard
17ngx_http_dav_module_ as well as this module for the missing methods.
18
19
20Build
21=====
22
23Building nginx_ with the module:
24
25.. code-block:: bash
26
27 # static module
28 $ ./configure --with-http_dav_module --add-module=/path/to/nginx-dav-ext-module
29
30 # dynamic module
31 $ ./configure --with-http_dav_module --add-dynamic-module=/path/to/nginx-dav-ext-module
32
33Trying to compile nginx_ with this module but without ngx_http_dav_module_ will
34result in compilation error.
35
36
37Requirements
38============
39
40- nginx_ version >= 1.13.4
41- ``libxml2`` + ``libxslt``
42
43The ``libxslt`` library is technically redundant and is only required since this
44combination is supported by nginx_ for the xslt module.
45Using builtin nginx mechanisms for linking against third-party libraries
46brings certain compatibility benefits.
47However this redundancy can be easily eliminated in the ``config`` file.
48
49
50Testing
51=======
52
53The module tests require standard nginx-tests_ and Perl ``HTTP::DAV`` library.
54
55.. code-block:: bash
56
57 $ export PERL5LIB=/path/to/nginx-tests/lib
58 $ export TEST_NGINX_BINARY=/path/to/nginx
59 $ prove t
60
61
62Locking
63=======
64
65- Only the exclusive write locks are supported, which is the only type of locks
66 described in the WebDAV_ specification.
67
68- All currently held locks are kept in a list.
69 Checking if an object is constrained by a lock requires O(n) operations.
70 A huge number of simultaneously held locks may degrade performance.
71 Thus it is not recommended to have a large lock timeout which would increase
72 the number of locks.
73
74
75Directives
76==========
77
78dav_ext_methods
79---------------
80
81========== ====
82*Syntax:* ``dav_ext_methods [PROPFIND] [OPTIONS] [LOCK] [UNLOCK]``
83*Context:* http, server, location
84========== ====
85
86Enables support for the specified WebDAV methods in the current scope.
87
88dav_ext_lock_zone
89-----------------
90
91========== ====
92*Syntax:* ``dav_ext_lock_zone zone=NAME:SIZE [timeout=TIMEOUT]``
93*Context:* http
94========== ====
95
96Defines a shared zone for WebDAV locks with specified NAME and SIZE.
97Also, defines a lock expiration TIMEOUT.
98Default lock timeout value is 1 minute.
99
100
101dav_ext_lock
102------------
103
104========== ====
105*Syntax:* ``dav_ext_lock zone=NAME``
106*Context:* http, server, location
107========== ====
108
109Enables WebDAV locking in the specified scope.
110Locks are stored in the shared zone specified by NAME.
111This zone must be defined with the ``dav_ext_lock_zone`` directive.
112
113Note that even though this directive enables locking capabilities in the
114current scope, HTTP methods LOCK and UNLOCK should also be explicitly specified
115in the ``dav_ext_methods``.
116
117
118Example 1
119=========
120
121Simple lockless example::
122
123 location / {
124 root /data/www;
125
126 dav_methods PUT DELETE MKCOL COPY MOVE;
127 dav_ext_methods PROPFIND OPTIONS;
128 }
129
130
131Example 2
132=========
133
134WebDAV with locking::
135
136 http {
137 dav_ext_lock_zone zone=foo:10m;
138
139 ...
140
141 server {
142 ...
143
144 location / {
145 root /data/www;
146
147 dav_methods PUT DELETE MKCOL COPY MOVE;
148 dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
149 dav_ext_lock zone=foo;
150 }
151 }
152 }
153
154
155Example 3
156=========
157
158WebDAV with locking which works with MacOS client::
159
160 http {
161 dav_ext_lock_zone zone=foo:10m;
162
163 ...
164
165 server {
166 ...
167
168 location / {
169 root /data/www;
170
171 # enable creating directories without trailing slash
172 set $x $uri$request_method;
173 if ($x ~ [^/]MKCOL$) {
174 rewrite ^(.*)$ $1/;
175 }
176
177 dav_methods PUT DELETE MKCOL COPY MOVE;
178 dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
179 dav_ext_lock zone=foo;
180 }
181 }
182 }
183
184.. _ngx_http_dav_module: http://nginx.org/en/docs/http/ngx_http_dav_module.html
185.. _nginx-tests: http://hg.nginx.org/nginx-tests
186.. _nginx: http://nginx.org
187.. _WebDAV: https://tools.ietf.org/html/rfc4918
188.. _`RFC4918 If Header`: https://tools.ietf.org/html/rfc4918#section-10.4
189