...
 
Commits (4)
nginx (1.14.2-2bionic0) bionic; urgency=medium
nginx (1.14.2-3bionic2) bionic; urgency=medium
* Non-maintainer upload.
* Move stream module to static for STS to work.
-- Filip Chabik <hadret@gmail.com> Tue, 16 Apr 2019 10:54:33 +0000
nginx (1.14.2-3bionic1) bionic; urgency=medium
* Ditch no longer needed openssl-1.1.0 patch for lua module.
* Fix wrong paths for STS modules.
-- Filip Chabik <hadret@gmail.com> Tue, 16 Apr 2019 07:48:04 +0000
nginx (1.14.2-3bionic0) bionic; urgency=medium
* Introduce stream server traffic status dynamic modules.
* Upgrade 3rd party modules:
* http-lua to 0.10.14
* nchan module to 1.2.5;
* http-dav-ext to 3.0.0
* http-fancyindex to 0.4.3
* http-cache-purge to 2.5
* Fix and provide where missing watch files for the modules.
-- Filip Chabik <hadret@gmail.com> Mon, 15 Apr 2019 10:34:37 +0000
nginx (1.14.2-2bionic0) bionic; urgency=medium
* Replace built-in geoip with third-party geoip2.
-- Filip Chabik <hadret@gmail.com> Fri, 08 Feb 2019 10:13:59 +0000
......
......@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
XSBC-Original-Maintainer: Debian Nginx Maintainers <pkg-nginx-maintainers@lists.alioth.debian.org>
Uploaders: Christos Trochalakis <ctrochalakis@debian.org>
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 10),
dh-systemd,
po-debconf,
dpkg-dev (>= 1.15.5),
......@@ -74,7 +74,6 @@ Depends: libnginx-mod-http-geoip2 (= ${binary:Version}),
libnginx-mod-http-image-filter (= ${binary:Version}),
libnginx-mod-http-xslt-filter (= ${binary:Version}),
libnginx-mod-mail (= ${binary:Version}),
libnginx-mod-stream (= ${binary:Version}),
nginx-common (= ${source:Version}),
${misc:Depends},
${shlibs:Depends}
......@@ -110,13 +109,14 @@ Depends: libnginx-mod-http-auth-ldap (= ${binary:Version}),
libnginx-mod-http-echo (= ${binary:Version}),
libnginx-mod-http-geoip2 (= ${binary:Version}),
libnginx-mod-http-image-filter (= ${binary:Version}),
libnginx-mod-http-stream-server-traffic-status (= ${binary:Version}),
libnginx-mod-http-subs-filter (= ${binary:Version}),
libnginx-mod-http-upstream-fair (= ${binary:Version}),
libnginx-mod-http-upsync (= ${binary:Version}),
libnginx-mod-http-xslt-filter (= ${binary:Version}),
libnginx-mod-http-vhost-traffic-status (= ${binary:Version}),
libnginx-mod-mail (= ${binary:Version}),
libnginx-mod-stream (= ${binary:Version}),
libnginx-mod-stream-server-traffic-status (= ${binary:Version}),
nginx-common (= ${source:Version}),
${misc:Depends},
${shlibs:Depends}
......@@ -187,6 +187,7 @@ Depends: libnginx-mod-http-auth-ldap (= ${binary:Version}),
libnginx-mod-http-image-filter (= ${binary:Version}),
libnginx-mod-http-lua (= ${binary:Version}),
libnginx-mod-http-perl (= ${binary:Version}),
libnginx-mod-http-stream-server-traffic-status (= ${binary:Version}),
libnginx-mod-http-subs-filter (= ${binary:Version}),
libnginx-mod-http-uploadprogress (= ${binary:Version}),
libnginx-mod-http-upstream-fair (= ${binary:Version}),
......@@ -195,7 +196,7 @@ Depends: libnginx-mod-http-auth-ldap (= ${binary:Version}),
libnginx-mod-http-vhost-traffic-status (= ${binary:Version}),
libnginx-mod-mail (= ${binary:Version}),
libnginx-mod-nchan (= ${binary:Version}),
libnginx-mod-stream (= ${binary:Version}),
libnginx-mod-stream-server-traffic-status (= ${binary:Version}),
nginx-common (= ${source:Version}),
${misc:Depends},
${shlibs:Depends}
......@@ -267,16 +268,6 @@ Description: Mail module for Nginx
The module supports proxying all the standard mail protocols such as IMAP,
POP3 & SMTP.
Package: libnginx-mod-stream
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Stream module for Nginx
The nginx_stream module adds stream proxy support to nginx.
.
Stream module supports loadbalancing & proxying to TCP servers. The module
also supports ACLs/connection limiting and configuring multiple operational
parameters.
Package: libnginx-mod-http-perl
Architecture: any
Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
......@@ -461,3 +452,35 @@ Depends: ${misc:Depends}, ${shlibs:Depends}
Description: dynamic upstreams via consul or etcd for Nginx
Sync upstreams from consul or etcd, dynamically modify backend servers
attributes like weight, max_fails etc. without the need to reload nginx.
Package: libnginx-mod-http-stream-server-traffic-status
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends},
libnginx-mod-stream-server-traffic-status (= ${binary:Version}),
Description: stream server traffic status core module for Nginx
STS module provides access to stream server traffic status information.
It provides support for implementing stream server stats, filters,
limits and embedded variables.
.
This package provides core module necessary to run STS.
Package: libnginx-mod-stream-server-traffic-status
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends},
libnginx-mod-http-stream-server-traffic-status (= ${binary:Version}),
Description: stream server traffic status module for Nginx
STS module provides access to stream server traffic status information.
It provides support for implementing display and control of stream
server stats and
.
This package provides second module necessary to run STS.
Package: libnginx-mod-pagespeed
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: modpagespeed support for Nginx
The nginx PageSpeed improves web page latency by changing the resources on
that web page to implement web performance best practices.
.
The PageSpeed Modules, mod_pagespeed and ngx_pagespeed, are open-source
webserver modules that optimize your site automatically.
#!/usr/bin/perl -w
use File::Basename;
# Guess module name
$module = basename($0, '.nginx');
$module =~ s/^libnginx-mod-//;
$modulepath = $module;
$modulepath =~ s/-/_/g;
print "mod debian/build-extras/objs/ngx_${modulepath}.so\n";
print "mod debian/libnginx-mod.conf/mod-${module}.conf\n";
#!/usr/bin/perl -w
use File::Basename;
# Guess module name
$module = basename($0, '.nginx');
$module =~ s/^libnginx-mod-//;
$modulepath = $module;
$modulepath =~ s/-/_/g;
print "mod debian/build-extras/objs/ngx_${modulepath}_module.so\n";
print "mod debian/libnginx-mod.conf/mod-${module}.conf\n";
load_module modules/ngx_stream_server_traffic_status_module.so;
load_module modules/ngx_pagespeed.so;
load_module modules/ngx_http_stream_server_traffic_status_module.so;
load_module modules/ngx_stream_module.so;
......@@ -18,9 +18,8 @@ Files-Excluded: .gitignore .gitattributes .travis.yml
Module: http-lua
Homepage: https://github.com/openresty/lua-nginx-module
Version: 0.10.11
Version: 0.10.14
Patch:
openssl-1.1.0.patch
discover-luajit-2.1.patch
Files-Excluded: .gitignore .gitattributes .travis.yml .github
......@@ -34,8 +33,8 @@ Patch:
Module: nchan
Homepage: https://github.com/slact/nchan
Version: 1.0.8
Files-Excluded: dev nchan_logo.png NchanSubscriber.js src/hiredis
Version: 1.2.5
Files-Excluded: dev nchan_logo.png NchanSubscriber.js
Module: http-uploadprogress
Homepage: https://github.com/masterzen/nginx-upload-progress-module
......@@ -44,15 +43,15 @@ Version: 0.9.2
Module: http-cache-purge
Homepage: https://github.com/nginx-modules/ngx_cache_purge
Version: 2.4.2
Version: 2.5
Module: http-dav-ext
Homepage: https://github.com/arut/nginx-dav-ext-module
Version: 0.1.0
Version: 3.0.0
Module: http-fancyindex
Homepage: https://github.com/aperezdc/ngx-fancyindex
Version: 0.4.2
Version: 0.4.3
Files-Excluded: .gitignore .travis.yml
Module: http-subs-filter
......@@ -84,3 +83,12 @@ Version: 219131a
Module: http-geoip2
Homepage: https://github.com/leev/ngx_http_geoip2_module
Version: 3.2
Module: stream-server-traffic-status
Homepage: https://github.com/vozlt/nginx-module-stream-sts
Version: v0.1.1
Module: http-stream-server-traffic-status
Homepage: https://github.com/vozlt/nginx-module-sts
Version: v0.1.1
......@@ -12,39 +12,38 @@ cache:
env:
global:
- JOBS=4
- NGINX_VERSION=1.12.0
- NGINX_PREFIX=/opt/nginx
- OPENSSL_PREFIX=/opt/ssl
- OPENSSL_LIB=$OPENSSL_PREFIX/lib
- OPENSSL_INC=$OPENSSL_PREFIX/include
- OPENSSL_VER=1.0.2k
matrix:
- NGINX_VERSION=1.14.0
- NGINX_VERSION=1.15.2
before_install:
- sudo apt-get install -qq -y cpanminus
- mkdir --parents download-cache
- sudo apt-get update -qq
- sudo apt-get install -qq zlib1g-dev libpcre3-dev cpanminus
# Get OpenSSL 1.0.2 from Ubuntu Xenial
# https://packages.ubuntu.com/xenial-updates/libssl1.0.0
- test -f download-cache/libssl1.0.0_1.0.2g-1ubuntu4.13_amd64.deb || wget -O download-cache/libssl1.0.0_1.0.2g-1ubuntu4.13_amd64.deb "http://de.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu4.13_amd64.deb"
# https://packages.ubuntu.com/xenial/libssl-dev
- test -f download-cache/libssl-dev_1.0.2g-1ubuntu4.13_amd64.deb || wget -O download-cache/libssl-dev_1.0.2g-1ubuntu4.13_amd64.deb "http://de.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2g-1ubuntu4.13_amd64.deb"
- sudo dpkg -i download-cache/libssl*_amd64.deb
# Test::Nginx
- git clone https://github.com/openresty/test-nginx.git test-nginx
- cd test-nginx/ && sudo cpanm . && cd ..
# NGINX source
- test -f download-cache/nginx-$NGINX_VERSION.tar.gz || wget -O download-cache/nginx-$NGINX_VERSION.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
install:
- if [ ! -d /opt ]; then mkdir /opt; fi
- if [ ! -d download-cache ]; then mkdir download-cache; fi
- if [ ! -f download-cache/nginx-$NGINX_VERSION.tar.gz ]; then wget -O download-cache/nginx-$NGINX_VERSION.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz; fi
- if [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -O download-cache/openssl-$OPENSSL_VER.tar.gz https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz; fi
- git clone https://github.com/openresty/test-nginx.git
- tar -xzf download-cache/nginx-${NGINX_VERSION}.tar.gz
- cd nginx-${NGINX_VERSION}/
- ./configure --prefix=${NGINX_PREFIX} --with-debug --with-http_ssl_module --add-module=${PWD}/..
- make -j${JOBS}
- sudo make install
- cd ..
- export PATH="${NGINX_PREFIX}/sbin:$PATH"
# - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
script:
- cd test-nginx/ && sudo cpanm . && cd ..
- tar zxf download-cache/openssl-$OPENSSL_VER.tar.gz
- cd openssl-$OPENSSL_VER/
- ./config shared --prefix=$OPENSSL_PREFIX -DPURIFY > build.log 2>&1 || (cat build.log && exit 1)
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1)
- cd ..
- tar zxf download-cache/nginx-$NGINX_VERSION.tar.gz
- cd nginx-$NGINX_VERSION/
- ./configure --prefix=$NGINX_PREFIX --with-debug --add-module=$PWD/.. > build.log 2>&1 || (cat build.log && exit 1)
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- sudo make install > build.log 2>&1 || (cat build.log && exit 1)
- cd ..
- export PATH=$NGINX_PREFIX/sbin:$PATH
# - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
- nginx -V
- ldd `which nginx`
- ldd $(which nginx)
- prove t
2017-09-28 VERSION 2.4.2
* Fix segfault in call to ngx_read_file of partial key purge
* Fix segfault in cplcf->conf->purge_all with separate location syntax
2018-08-04 VERSION 2.5
* feat/docs: cache_purge_response_type directive, selecting response type (html|json|xml|text)
* break: changed status of HTTP code 404 (Not Found) to 412 (Precondition Failed)
* fix: remove path information of response body (#4, 3a8c08a, #11)
2017-02-21 VERSION 2.4.1
* Fix compatibility with nginx-1.11.6+, Sułowicz Paweł
......
......@@ -90,6 +90,17 @@ uwsgi_cache_purge
Sets area and key used for purging selected pages from `uWSGI`'s cache.
Configuration directives (Optional)
===================================================
cache_purge_response_type
-----------------
* **syntax**: `cache_purge_response_type html|json|xml|text`
* **default**: `html`
* **context**: `http`, `server`, `location`
Sets a response type of purging result.
Partial Keys
......@@ -155,6 +166,61 @@ Sample configuration (separate location syntax)
}
}
Sample configuration (Optional)
===============================================
http {
proxy_cache_path /tmp/cache keys_zone=tmpcache:10m;
cache_purge_response_type text;
server {
cache_purge_response_type json;
location / { #json
proxy_pass http://127.0.0.1:8000;
proxy_cache tmpcache;
proxy_cache_key $uri$is_args$args;
}
location ~ /purge(/.*) { #xml
allow 127.0.0.1;
deny all;
proxy_cache_purge tmpcache $1$is_args$args;
cache_purge_response_type xml;
}
location ~ /purge2(/.*) { # json
allow 127.0.0.1;
deny all;
proxy_cache_purge tmpcache $1$is_args$args;
}
}
server {
location / { #text
proxy_pass http://127.0.0.1:8000;
proxy_cache tmpcache;
proxy_cache_key $uri$is_args$args;
}
location ~ /purge(/.*) { #text
allow 127.0.0.1;
deny all;
proxy_cache_purge tmpcache $1$is_args$args;
}
location ~ /purge2(/.*) { #html
allow 127.0.0.1;
deny all;
proxy_cache_purge tmpcache $1$is_args$args;
cache_purge_response_type html;
}
}
}
Testing
=======
......
......@@ -92,10 +92,10 @@ qr/\[(warn|error|crit|alert|emerg)\]/
--- config eval: $::config
--- request
PURGE /purge/proxy/passwd
--- error_code: 404
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 404 Not Found
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
......
......@@ -94,10 +94,10 @@ qr/\[(warn|error|crit|alert|emerg)\]/
--- config eval: $::config
--- request
PURGE /purge/proxy/passwd
--- error_code: 404
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 404 Not Found
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
......
......@@ -124,10 +124,10 @@ qr/\[(warn|error|crit|alert|emerg)\]/
--- config eval: $::config
--- request
PURGE /proxy/passwd
--- error_code: 404
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 404 Not Found
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
......@@ -190,10 +190,10 @@ qr/\[(warn|error|crit|alert|emerg)\]/
--- config eval: $::config_allowed
--- request
PURGE /proxy/passwd
--- error_code: 404
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 404 Not Found
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
......
......@@ -127,10 +127,10 @@ qr/\[(warn|error|crit|alert|emerg)\]/
--- config eval: $::config
--- request
PURGE /proxy/passwd
--- error_code: 404
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 404 Not Found
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
......@@ -193,10 +193,10 @@ qr/\[(warn|error|crit|alert|emerg)\]/
--- config eval: $::config_allowed
--- request
PURGE /proxy/passwd
--- error_code: 404
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 404 Not Found
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
......
......@@ -25,7 +25,7 @@ our $config = <<'_EOC_';
location = /etc/passwd {
root /var/www/html;
root /;
}
_EOC_
......
......@@ -25,7 +25,7 @@ our $config = <<'_EOC_';
location = /etc/passwd {
root /var/www/html;
root /;
}
_EOC_
......
# vi:filetype=perl
use lib 'lib';
use Test::Nginx::Socket;
repeat_each(1);
plan tests => repeat_each() * (blocks() * 4 + 3 * 1);
our $http_config = <<'_EOC_';
proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m;
proxy_temp_path /tmp/ngx_cache_purge_temp 1 2;
_EOC_
our $config = <<'_EOC_';
cache_purge_response_type json;
location /proxy {
proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd;
proxy_cache test_cache;
proxy_cache_key $uri$is_args$args;
proxy_cache_valid 3m;
add_header X-Cache-Status $upstream_cache_status;
}
location ~ /purge(/.*) {
proxy_cache_purge test_cache $1$is_args$args;
cache_purge_response_type html;
}
location ~ /purge_json(/.*) {
proxy_cache_purge test_cache $1$is_args$args;
}
location ~ /purge_xml(/.*) {
proxy_cache_purge test_cache $1$is_args$args;
cache_purge_response_type xml;
}
location ~ /purge_text(/.*) {
proxy_cache_purge test_cache $1$is_args$args;
cache_purge_response_type text;
}
location = /etc/passwd {
root /;
}
_EOC_
worker_connections(128);
no_shuffle();
run_tests();
no_diff();
__DATA__
=== TEST 1: prepare
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 2: get from cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd
--- error_code: 200
--- response_headers
Content-Type: text/plain
X-Cache-Status: HIT
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 5: < 0.8.3 or < 0.7.62
=== TEST 3: purge from cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
PURGE /purge/proxy/passwd
--- error_code: 200
--- response_headers
Content-Type: text/html
--- response_body_like: Successful purge
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 4: purge from empty cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
PURGE /purge/proxy/passwd
--- error_code: 412
--- response_headers
Content-Type: text/html
--- response_body_like: 412 Precondition Failed
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 5: get from source
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd
--- error_code: 200
--- response_headers
Content-Type: text/plain
X-Cache-Status: MISS
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 5: < 0.8.3 or < 0.7.62
=== TEST 6: get from cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd
--- error_code: 200
--- response_headers
Content-Type: text/plain
X-Cache-Status: HIT
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 5: < 0.8.3 or < 0.7.62
=== TEST 7-prepare: prepare purge
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd?t=7
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 7: get a JSON response after purge from cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
PURGE /purge_json/proxy/passwd?t=7
--- error_code: 200
--- response_headers
Content-Type: application/json
--- response_body_like: {\"Key\": \"\/proxy\/passwd\?t=7\"
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 8-prepare: prepare purge
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd?t=8
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 8: get a XML response after purge from cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
PURGE /purge_xml/proxy/passwd?t=8
--- error_code: 200
--- response_headers
Content-Type: text/xml
--- response_body_like: \<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><status><Key><\!\[CDATA\[\/proxy\/passwd\?t=8\]\]><\/Key>
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 9-prepare: prepare purge
--- http_config eval: $::http_config
--- config eval: $::config
--- request
GET /proxy/passwd?t=9
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body_like: root
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
=== TEST 9: get a TEXT response after purge from cache
--- http_config eval: $::http_config
--- config eval: $::config
--- request
PURGE /purge_text/proxy/passwd?t=9
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body_like: Key
--- timeout: 10
--- no_error_log eval
qr/\[(warn|error|crit|alert|emerg)\]/
--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
Copyright (c) 2012-2017, Roman Arutyunyan
Copyright (C) 2012-2018 Roman Arutyunyan
All rights reserved.
Redistribution and use in source and binary forms, with or without
......
......@@ -2,40 +2,187 @@
nginx-dav-ext-module
********************
NGINX WebDAV missing commands support (PROPFIND & OPTIONS)
nginx_ WebDAV_ PROPFIND,OPTIONS,LOCK,UNLOCK support.
Copyright |copy| 2012-2017 Arutyunyan Roman (arutyunyan.roman@gmail.com)
.. contents::
.. |copy| unicode:: U+000A9 .. COPYRIGHT SIGN
For full WebDAV support in NGINX you need to enable the standard NGINX
WebDAV module (providing partial WebDAV implementation) as well as
this module for missing methods:
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.
.. code-block:: bash
$ ./configure --with-http_dav_module --add-module=/path/to/this-module
Build
=====
The module can be built dynamically:
Building nginx_ with the module:
.. code-block:: bash
$ ./configure --with-http_dav_module --add-dynamic-module=/path/to/this-module
# 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
============
``libexpat-dev``
- 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 {
...
Example config
==============
location / {
root /data/www;
.. code-block::
# enable creating directories without trailing slash
set $x $uri$request_method;
if ($x ~ [^/]MKCOL$) {
rewrite ^(.*)$ $1/;
}
location / {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
dav_ext_lock zone=foo;
}
}
}
root /var/root/;
}
.. _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
ngx_addon_name=ngx_http_dav_ext_module
if [ -f auto/module ] ; then
ngx_module_type=HTTP
ngx_module_name=ngx_http_dav_ext_module
ngx_module_type=HTTP
ngx_module_name=ngx_http_dav_ext_module
ngx_module_libs=-lexpat
ngx_module_srcs="$ngx_addon_dir/ngx_http_dav_ext_module.c"
# nginx has robust builtin support for linking against
# libxml2+libxslt. This is definitelty the right way to go if
# building nginx with the xslt module, in which case libxslt will
# be linked anyway. In other cases libxslt is just redundant.
# If that's a big deal, libxml2 can be linked directly:
# ngx_module_libs=-lxml2
. auto/module
ngx_module_libs=LIBXSLT
else
HTTP_MODULES="$HTTP_MODULES ngx_http_dav_ext_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_dav_ext_module.c"
CORE_LIBS="$CORE_LIBS -lexpat"
fi
ngx_module_srcs="$ngx_addon_dir/ngx_http_dav_ext_module.c"
. auto/module
#!/usr/bin/perl
# (C) Roman Arutyunyan
# Tests for nginx-dav-ext-module.
###############################################################################
use warnings;
use strict;
use Test::More;
BEGIN { use FindBin; chdir($FindBin::Bin); }
use lib 'lib';
use Test::Nginx;
use HTTP::DAV
###############################################################################
select STDERR; $| = 1;
select STDOUT; $| = 1;
my $t = Test::Nginx->new()->has(qw/http dav/)->plan(20);
$t->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
daemon off;
events {
}
http {
%%TEST_GLOBALS_HTTP%%
dav_ext_lock_zone zone=foo:10m timeout=10s;
server {
listen 127.0.0.1:8080;
server_name localhost;
location / {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
dav_ext_lock zone=foo;
}
}
}
EOF
$t->write_file('foo', 'foo');
$t->run();
###############################################################################
my $url = "http://127.0.0.1:8080";
my $content;
my $d = HTTP::DAV->new();
$d->open($url);
my $d2 = HTTP::DAV->new();
$d2->open($url);
#debug:
#$d->DebugLevel(3);
#see /tmp/perldav_debug.txt.
my $p = $d->propfind('/', 1);
is($p->is_collection, 1, 'propfind dir collection');
is($p->get_property('displayname'), '/', 'propfind dir displayname');
is($p->get_uri(), 'http://127.0.0.1:8080/', 'propfind dir uri');
$p = $d->propfind('/foo');
is($p->is_collection, 0, 'propfind file collection');
is($p->get_property('displayname'), 'foo', 'propfind file displayname');
is($p->get_uri(), 'http://127.0.0.1:8080/foo', 'propfind file uri');
is($p->get_property('getcontentlength'), '3', 'propfind file size');
$d->lock('/foo');
is($d->lock('/foo'), 0, 'prevent double lock');
$d->unlock('/foo');
is($d->lock('/foo'), 1, 'relock');
$d->lock('/bar');
$p = $d->propfind('/bar');
is($p->get_property('displayname'), 'bar', 'lock creates a file');
$d->get('/bar', \$content) or $content = 'none';
is($content, '', 'lock creates an empty file');
$content = "bar";
$d->put(\$content, '/bar');
$d->get('/bar', \$content) or $content = '';
is($content, 'bar', 'put lock');
$content = "qux";
$d2->put(\$content, '/bar');
$d2->get('/bar', \$content) or $content = '';
isnt($content, 'qux', 'prevent put lock');
$d->mkcol('/d/');
$d->lock('/d/');
$d->copy('/bar', '/d/bar');
$d->get('/d/bar', \$content) or $content = '';
is($content, 'bar', 'copy lock');
$d2->copy('/bar', '/d/qux');
$d2->get('/d/qux', \$content) or $content = '';
isnt($content, 'bar', 'prevent copy lock');
$d2->delete('/d/bar');
$d2->get('/d/bar', \$content) or $content = '';
is($content, 'bar', 'prevent delete lock');
$d->delete('/d/bar');
$d->get('/d/bar', \$content) or $content = '';
is($content, '', 'delete lock');
$d->mkcol('/d/c/');
$p = $d->propfind('/d/c/');
is($p->is_collection, 1, 'mkcol lock');
$d2->mkcol('/d/e/');
is($d2->propfind('/d/e/'), 0, 'prevent mkcol lock');
$d->unlock('/d/');
$d->lock('/d/', -depth=>"0");
$content = 'qux';
$d2->put(\$content, '/d/c/qux');
$d2->get('/d/c/qux', \$content) or $content = '';
is($content, 'qux', 'put to a depth-0-locked subdirectory');
###############################################################################
......@@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
## [0.4.3] - 2018-07-03
### Added
- Table cells now have class names, which allows for better CSS styling.
(Patch by qjqqyy <<gyula@nyirfalvi.hu>>.)
- The test suite now can parse and check elements from the HTML returned
by the module, thanks to the [pup](https://github.com/EricChiang/pup)
tool.
### Fixed
- Sorting by file size now works correctly.
(Patch by qjqqyy <<gyula@nyirfalvi.hu>>.)
## [0.4.2] - 2017-08-19
### Changed
- Generated HTML from the default template is now proper HTML5, and it should
......@@ -118,7 +130,8 @@ All notable changes to this project will be documented in this file.
- `NEWS.rst` file, to act as change log.
[Unreleased]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.2...HEAD
[Unreleased]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.3...HEAD
[0.4.3]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/aperezdc/ngx-fancyindex/compare/v0.3.6...v0.4.0
......
......@@ -39,7 +39,7 @@ Alternatively, add extras repository first (for future updates) and install the
yum install nginx-module-fancyindex
Then load the module in `/etc/nginx/nginx.conf` using
Then load the module in `/etc/nginx/nginx.conf` using::
load_module "modules/ngx_http_fancyindex_module.so";
......@@ -51,7 +51,7 @@ series onwards will work. Note that the modules *might* compile with
versions in the 0.6 series by applying ``nginx-0.6-support.patch``, but this
is unsupported (YMMV).
In order to use the fancyindex_header_ and fancyindex_footer_ directives
In order to use the ``fancyindex_header_`` and ``fancyindex_footer_`` directives
you will also need the `ngx_http_addition_module <http://nginx.org/en/docs/http/ngx_http_addition_module.html>`_
built into Nginx.
......@@ -78,7 +78,8 @@ Building
Since version 0.4.0, the module can also be built as a
`dynamic module <https://www.nginx.com/resources/wiki/extending/converting/>`_,
using ``--add-dynamic-module=…`` instead and ``load_module "modules/ngx_http_fancyindex_module.so";`
using ``--add-dynamic-module=…`` instead and
``load_module "modules/ngx_http_fancyindex_module.so";``
in the configuration file
4. Build and install the software::
......@@ -114,8 +115,14 @@ achieved using the module:
`@TheInsomniac <https://github.com/TheInsomniac>`__. Uses custom header and
footer.
* `Theme <https://github.com/Naereen/Nginx-Fancyindex-Theme>`__ by
`Naereen <https://github.com/Naereen/>`__. Uses custom header and footer, the
`@Naereen <https://github.com/Naereen/>`__. Uses custom header and footer, the
header includes search field to filter by filename using JavaScript.
* `Theme <https://github.com/fraoustin/Nginx-Fancyindex-Theme>`__ by
`@fraoustin <https://github.com/fraoustin>`__. Responsive theme using
Material Design elements.
* `Theme <https://github.com/alehaa/nginx-fancyindex-flat-theme>`__ by
`@alehaa <https://github.com/alehaa>`__. Simple, flat theme based on
Bootstrap 4 and FontAwesome.
Directives
......
......@@ -772,7 +772,7 @@ make_content_buf(
* <td>size</td><td>date</td>
* </tr>
*/
len += ngx_sizeof_ssz("<tr><td><a href=\"")
len += ngx_sizeof_ssz("<tr><td class=\"link\"><a href=\"")
+ entry[i].name.len + entry[i].escape /* Escaped URL */
+ ngx_sizeof_ssz("?C=x&amp;O=y") /* URL sorting arguments */
+ ngx_sizeof_ssz("\" title=\"")
......@@ -780,9 +780,9 @@ make_content_buf(
+ ngx_sizeof_ssz("\">")
+ entry[i].name.len + entry[i].utf_len
+ alcf->name_length + ngx_sizeof_ssz("&gt;")