diff --git a/.travis.yml b/.travis.yml index 086ab81..5be4c36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ sudo: required -dist: trusty +dist: focal + +branches: + only: + - "master" os: linux @@ -7,7 +11,6 @@ language: c compiler: - gcc - - clang env: global: @@ -21,8 +24,7 @@ env: - NGX_BUILD_JOBS=$JOBS - TEST_NGINX_SLEEP=0.006 matrix: - - NGINX_VERSION=1.9.15 - - NGINX_VERSION=1.11.2 + - NGINX_VERSION=1.27.1 addons: apt: @@ -43,7 +45,7 @@ cache: - download-cache install: - - git clone https://github.com/openresty/nginx-devel-utils.git + - git clone https://github.com/openresty/openresty-devel-utils.git - git clone https://github.com/openresty/openresty.git ../openresty - git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx - git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module @@ -58,8 +60,8 @@ script: - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1) - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) - cd ../test-nginx && sudo cpanm . && cd .. - - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH + - export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH - export NGX_BUILD_CC=$CC - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1) - nginx -V - - prove -r t + - prove -I. -r t diff --git a/README.md b/README.md index 443c5c3..d6c888c 100644 --- a/README.md +++ b/README.md @@ -263,23 +263,23 @@ You're recommended to install this module (as well as the Nginx core and many ot Alternatively, you can install this module manually with the Nginx source: Grab the nginx source code from [nginx.org](http://nginx.org/), for example, -the version 1.9.7 (see [nginx compatibility](#compatibility)), and then build the source with this module: +the version 1.13.6 (see [nginx compatibility](#compatibility)), and then build the source with this module: ```bash +wget 'http://nginx.org/download/nginx-1.13.6.tar.gz' +tar -xzvf nginx-1.13.6.tar.gz +cd nginx-1.13.6/ - $ wget 'http://nginx.org/download/nginx-1.9.7.tar.gz' - $ tar -xzvf nginx-1.9.7.tar.gz - $ cd nginx-1.9.7/ +# Here we assume you would install you nginx under /opt/nginx/. +./configure --prefix=/opt/nginx \ + --add-module=/path/to/ngx_devel_kit \ + --add-module=/path/to/array-var-nginx-module - # Here we assume you would install you nginx under /opt/nginx/. - $ ./configure --prefix=/opt/nginx \ - --add-module=/path/to/array-var-nginx-module - - $ make -j2 - $ make install +make -j2 +make install ``` -Download the latest version of the release tarball of this module from [array-var-nginx-module file list](https://github.com/openresty/array-var-nginx-module/tags). +Download the latest version of the release tarball of this module from [array-var-nginx-module file list](https://github.com/openresty/array-var-nginx-module/tags), and the latest tarball for [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit) from its [file list](https://github.com/simplresty/ngx_devel_kit/tags). Also, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org). @@ -304,6 +304,10 @@ Compatibility The following versions of Nginx should work with this module: +* **1.13.x** (last tested: 1.13.6) +* **1.12.x** +* **1.11.x** (last tested: 1.11.2) +* **1.10.x** * **1.9.x** (last tested: 1.9.7) * **1.8.x** * **1.7.x** (last tested: 1.7.10) diff --git a/src/ngx_http_array_var_module.c b/src/ngx_http_array_var_module.c index 0b715b1..76c4df7 100644 --- a/src/ngx_http_array_var_module.c +++ b/src/ngx_http_array_var_module.c @@ -553,6 +553,9 @@ ngx_http_array_var_map(ngx_http_request_t *r, ngx_str_t *res, value = array->elts; array_it = ngx_http_get_indexed_variable(r, conf->array_it_index); + if (array_it == NULL) { + return NGX_ERROR; + } if (conf->in_place) { new_array = array; diff --git a/valgrind.suppress b/valgrind.suppress index ab1e4bb..50011ab 100644 --- a/valgrind.suppress +++ b/valgrind.suppress @@ -1,29 +1,29 @@ { - -Memcheck:Param -socketcall.sendmsg(msg.msg_iov[i]) -fun:sendmsg -fun:ngx_write_channel -fun:ngx_signal_worker_processes -fun:ngx_master_process_cycle -fun:main + + Memcheck:Param + socketcall.sendmsg(msg.msg_iov[i]) + fun:sendmsg + fun:ngx_write_channel + fun:ngx_signal_worker_processes + fun:ngx_master_process_cycle + fun:main } { - -Memcheck:Addr4 -fun:ngx_init_cycle -fun:ngx_master_process_cycle -fun:main + + Memcheck:Addr4 + fun:ngx_init_cycle + fun:ngx_master_process_cycle + fun:main } { - -Memcheck:Param -socketcall.sendmsg(msg.msg_iov[i]) -fun:__sendmsg_nocancel -fun:ngx_write_channel -fun:ngx_signal_worker_processes -fun:ngx_master_process_cycle -fun:main + + Memcheck:Param + socketcall.sendmsg(msg.msg_iov[i]) + fun:__sendmsg_nocancel + fun:ngx_write_channel + fun:ngx_signal_worker_processes + fun:ngx_master_process_cycle + fun:main } { @@ -34,46 +34,39 @@ fun:main } { - Memcheck:Leak - fun:malloc - fun:ngx_alloc - fun:(below main) -} -{ - -Memcheck:Param -socketcall.sendmsg(msg.msg_iov[i]) -fun:__sendmsg_nocancel -fun:ngx_write_channel -fun:ngx_signal_worker_processes -fun:ngx_master_process_cycle -fun:main + Memcheck:Param + socketcall.sendmsg(msg.msg_iov[i]) + fun:__sendmsg_nocancel + fun:ngx_write_channel + fun:ngx_signal_worker_processes + fun:ngx_master_process_cycle + fun:main } { - -Memcheck:Param -socketcall.sendmsg(msg.msg_iov[i]) -fun:__sendmsg_nocancel -fun:ngx_write_channel -fun:ngx_master_process_cycle -fun:main + + Memcheck:Param + socketcall.sendmsg(msg.msg_iov[i]) + fun:__sendmsg_nocancel + fun:ngx_write_channel + fun:ngx_master_process_cycle + fun:main } { - -Memcheck:Param -socketcall.sendmsg(msg.msg_iov[i]) -fun:__sendmsg_nocancel -fun:ngx_write_channel -fun:ngx_pass_open_channel -fun:ngx_start_worker_processes -fun:ngx_master_process_cycle -fun:main + + Memcheck:Param + socketcall.sendmsg(msg.msg_iov[i]) + fun:__sendmsg_nocancel + fun:ngx_write_channel + fun:ngx_pass_open_channel + fun:ngx_start_worker_processes + fun:ngx_master_process_cycle + fun:main } { - -Memcheck:Param -epoll_ctl(event) -fun:epoll_ctl + + Memcheck:Param + epoll_ctl(event) + fun:epoll_ctl } { nginx-core-process-init @@ -157,3 +150,22 @@ fun:epoll_ctl fun:do_preload fun:dl_main } +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_single_process_cycle +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_worker_process_init + fun:ngx_worker_process_cycle +}