nginx: Add missing WebDAV methods support (PROPFIND & OPTIONS) 6679/head
authorRuixi Zhou <zhouruixi@gmail.com>
Sun, 12 Aug 2018 06:23:50 +0000 (14:23 +0800)
committerRuixi Zhou <zhouruixi@gmail.com>
Tue, 21 Aug 2018 00:14:44 +0000 (08:14 +0800)
Nginx provide WebDAV methods PUT, DELETE, MKCOL, COPY, and MOVE with
http_dav_module. But most WebDAV clients that require additional WebDAV
methods (PROPFIND & OPTIONS) to operate. Add missing methods support
with Arutyunyan Roman (arutyunyan.roman@gmail.com)'s nginx-dav-ext-module.
(see: http://nginx.org/en/docs/http/ngx_http_dav_module.html
https://github.com/arut/nginx-dav-ext-module)

Example config:
location / {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;

root /var/root/;
}

Signed-off-by: Ruixi Zhou <zhouruixi@gmail.com>
net/nginx/Makefile

index 4880f7dafb7ac5a3431ee1b6c531b11276608191..c0a7a1c73660dac03f3a8e53789c69e88c4b915e 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nginx
 PKG_VERSION:=1.15.2
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://nginx.org/download/
@@ -78,7 +78,7 @@ define Package/nginx/default
   TITLE:=Nginx web server
   URL:=http://nginx.org/
   DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl \
-     +NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +libpthread
+       +NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +libpthread +NGINX_DAV:libexpat
 endef
 
 define Package/nginx/description
@@ -107,7 +107,7 @@ Package/nginx-ssl/description = $(Package/nginx/description) \
 define Package/nginx-all-module
   $(Package/nginx/default)
   TITLE += with ALL module selected
-  DEPENDS:=+libpcre +libopenssl +zlib +liblua +libpthread
+  DEPENDS:=+libpcre +libopenssl +zlib +liblua +libpthread +libexpat
   VARIANT:=all-module
   PROVIDES:=nginx
 endef
@@ -247,7 +247,7 @@ ifneq ($(BUILD_VARIANT),all-module)
     ADDITIONAL_MODULES += --with-http_flv_module
   endif
   ifeq ($(CONFIG_NGINX_DAV),y)
-    ADDITIONAL_MODULES += --with-http_dav_module
+    ADDITIONAL_MODULES += --with-http_dav_module --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module
   endif
   ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y)
     ADDITIONAL_MODULES += --with-http_auth_request_module
@@ -283,9 +283,11 @@ else
   CONFIG_NGINX_TS_MODULE:=y
   CONFIG_NGINX_NAXSI:=y
   CONFIG_NGINX_LUA:=y
+  CONFIG_NGINX_DAV:=y
   ADDITIONAL_MODULES += --with-http_ssl_module --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src \
     --add-module=$(PKG_BUILD_DIR)/lua-nginx --with-ipv6 --with-http_stub_status_module --with-http_flv_module \
-       --with-http_dav_module --with-http_auth_request_module --with-http_v2_module --with-http_realip_module \
+       --with-http_dav_module --add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module \
+       --with-http_auth_request_module --with-http_v2_module --with-http_realip_module \
        --with-http_secure_link_module --with-http_sub_module --add-module=$(PKG_BUILD_DIR)/nginx-headers-more \
        --add-module=$(PKG_BUILD_DIR)/nginx-brotli --add-module=$(PKG_BUILD_DIR)/nginx-rtmp \
        --add-module=$(PKG_BUILD_DIR)/nginx-ts
@@ -388,6 +390,7 @@ define Build/Prepare
        $(Prepare/nginx-headers-more)
        $(Prepare/nginx-rtmp)
        $(Prepare/nginx-ts)
+       $(Prepare/nginx-dav-ext-module)
 endef
 
 
@@ -499,6 +502,24 @@ ifeq ($(CONFIG_NGINX_LUA),y)
   endef
 endif
 
+
+ifeq ($(CONFIG_NGINX_DAV),y)
+  define Download/nginx-dav-ext-module
+    VERSION:=430fd774fe838a04f1a5defbf1dd571d42300cf9
+    SUBDIR:=nginx-dav-ext-module
+    FILE:=nginx-dav-ext-module-$(PKG_VERSION)-$$(VERSION).tar.gz
+    URL:=https://github.com/arut/nginx-dav-ext-module.git
+    MIRROR_HASH:=0566053a8756423ecab455fd9d218cec1e017598fcbb3d6415a06f816851611e
+    PROTO:=git
+  endef
+  $(eval $(call Download,nginx-dav-ext-module))
+
+  define Prepare/nginx-dav-ext-module
+       $(eval $(Download/nginx-dav-ext-module))
+       gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+  endef
+endif
+
 $(eval $(call BuildPackage,nginx))
 $(eval $(call BuildPackage,nginx-ssl))
 $(eval $(call BuildPackage,nginx-all-module))