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