Commit d17c9227 authored by Jerzy Kołosowski's avatar Jerzy Kołosowski

nginx update

parent 445f64fd
This diff is collapsed.
From d16babcc09050966f5055df41572429bd84d811a Mon Sep 17 00:00:00 2001
From: Andrei Belov <defanator@gmail.com>
Date: Wed, 22 Mar 2017 08:43:30 +0300
Subject: [PATCH] fixed build with nginx/1.11.11
Closes openresty/echo-nginx-module#64
See also:
http://hg.nginx.org/nginx/rev/e662cbf1b932
---
src/ngx_http_echo_request_info.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/ngx_http_echo_request_info.c b/src/ngx_http_echo_request_info.c
index d28ec4d..27b3c52 100644
--- a/src/ngx_http_echo_request_info.c
+++ b/src/ngx_http_echo_request_info.c
@@ -179,6 +179,9 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r,
ngx_int_t i, j;
ngx_buf_t *b, *first = NULL;
unsigned found;
+#if defined(nginx_version) && nginx_version >= 1011011
+ ngx_chain_t *cl;
+#endif
ngx_connection_t *c;
ngx_http_request_t *mr;
ngx_http_connection_t *hc;
@@ -215,8 +218,15 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r,
if (hc->nbusy) {
b = NULL;
+
+#if defined(nginx_version) && nginx_version >= 1011011
+ for (cl = hc->busy; cl; /* void */) {
+ b = cl->buf;
+ cl = cl->next;
+#else
for (i = 0; i < hc->nbusy; i++) {
b = hc->busy[i];
+#endif
if (first == NULL) {
if (mr->request_line.data >= b->pos
@@ -280,8 +290,15 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r,
}
if (hc->nbusy) {
+
+#if defined(nginx_version) && nginx_version >= 1011011
+ for (cl = hc->busy; cl; /* void */) {
+ b = cl->buf;
+ cl = cl->next;
+#else
for (i = 0; i < hc->nbusy; i++) {
b = hc->busy[i];
+#endif
if (!found) {
if (b != first) {
From 0459a285ca0159d45e73da8bd1164edb5c57cde3 Mon Sep 17 00:00:00 2001
From: Andrei Belov <defanator@gmail.com>
Date: Wed, 22 Mar 2017 07:50:57 +0300
Subject: [PATCH] feature: nginx 1.11.11+ can now build with this module.
Note: nginx 1.11.11+ are still not an officially supported target yet.
More work needed.
Closes openresty/lua-nginx-module#1016
See also:
http://hg.nginx.org/nginx/rev/e662cbf1b932
---
src/ngx_http_lua_common.h | 6 ++++
src/ngx_http_lua_headers.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++
src/ngx_http_lua_headers.h | 3 ++
src/ngx_http_lua_module.c | 13 ++++++++-
4 files changed, 89 insertions(+), 1 deletion(-)
diff --git a/src/ngx_http_lua_common.h b/src/ngx_http_lua_common.h
index 079a4dc..f37d776 100644
--- a/src/ngx_http_lua_common.h
+++ b/src/ngx_http_lua_common.h
@@ -199,6 +199,12 @@ struct ngx_http_lua_main_conf_s {
of reqeusts */
ngx_uint_t malloc_trim_req_count;
+#if nginx_version >= 1011011
+ /* the following 2 fields are only used by ngx.req.raw_headers() for now */
+ ngx_buf_t **busy_buf_ptrs;
+ ngx_int_t busy_buf_ptr_count;
+#endif
+
unsigned requires_header_filter:1;
unsigned requires_body_filter:1;
unsigned requires_capture_filter:1;
diff --git a/src/ngx_http_lua_headers.c b/src/ngx_http_lua_headers.c
index 2392598..6700ce8 100644
--- a/src/ngx_http_lua_headers.c
+++ b/src/ngx_http_lua_headers.c
@@ -26,6 +26,9 @@ static int ngx_http_lua_ngx_req_get_headers(lua_State *L);
static int ngx_http_lua_ngx_req_header_clear(lua_State *L);
static int ngx_http_lua_ngx_req_header_set(lua_State *L);
static int ngx_http_lua_ngx_resp_get_headers(lua_State *L);
+#if nginx_version >= 1011011
+void ngx_http_lua_ngx_raw_header_cleanup(void *data);
+#endif
static int
@@ -77,6 +80,11 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
size_t size;
ngx_buf_t *b, *first = NULL;
ngx_int_t i, j;
+#if nginx_version >= 1011011
+ ngx_buf_t **bb;
+ ngx_chain_t *cl;
+ ngx_http_lua_main_conf_t *lmcf;
+#endif
ngx_connection_t *c;
ngx_http_request_t *r, *mr;
ngx_http_connection_t *hc;
@@ -93,6 +101,10 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
return luaL_error(L, "no request object found");
}
+#if nginx_version >= 1011011
+ lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
+#endif
+
ngx_http_lua_check_fake_request(L, r);
mr = r->main;
@@ -109,8 +121,13 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
dd("hc->nbusy: %d", (int) hc->nbusy);
if (hc->nbusy) {
+#if nginx_version >= 1011011
+ dd("hc->busy: %p %p %p %p", hc->busy->buf->start, hc->busy->buf->pos,
+ hc->busy->buf->last, hc->busy->buf->end);
+#else
dd("hc->busy: %p %p %p %p", hc->busy[0]->start, hc->busy[0]->pos,
hc->busy[0]->last, hc->busy[0]->end);
+#endif
}
dd("request line: %p %p", mr->request_line.data,
@@ -146,9 +163,37 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
dd("size: %d", (int) size);
if (hc->nbusy) {
+#if nginx_version >= 1011011
+ if (hc->nbusy > lmcf->busy_buf_ptr_count) {
+ if (lmcf->busy_buf_ptrs) {
+ ngx_free(lmcf->busy_buf_ptrs);
+ }
+
+ lmcf->busy_buf_ptrs = ngx_alloc(hc->nbusy * sizeof(ngx_buf_t *),
+ r->connection->log);
+
+ if (lmcf->busy_buf_ptrs == NULL) {
+ return luaL_error(L, "no memory");
+ }
+
+ lmcf->busy_buf_ptr_count = hc->nbusy;
+ }
+
+ bb = lmcf->busy_buf_ptrs;
+ for (cl = hc->busy; cl; cl = cl->next) {
+ *bb++ = cl->buf;
+ }
+#endif
b = NULL;
+
+#if nginx_version >= 1011011
+ bb = lmcf->busy_buf_ptrs;
+ for (i = hc->nbusy; i > 0; i--) {
+ b = bb[i - 1];
+#else
for (i = 0; i < hc->nbusy; i++) {
b = hc->busy[i];
+#endif
dd("busy buf: %d: [%.*s]", (int) i, (int) (b->pos - b->start),
b->start);
@@ -223,8 +268,15 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
}
if (hc->nbusy) {
+
+#if nginx_version >= 1011011
+ bb = lmcf->busy_buf_ptrs;
+ for (i = hc->nbusy - 1; i >= 0; i--) {
+ b = bb[i];
+#else
for (i = 0; i < hc->nbusy; i++) {
b = hc->busy[i];
+#endif
if (!found) {
if (b != first) {
@@ -1431,4 +1483,20 @@ ngx_http_lua_ffi_get_resp_header(ngx_http_request_t *r,
#endif /* NGX_LUA_NO_FFI_API */
+#if nginx_version >= 1011011
+void
+ngx_http_lua_ngx_raw_header_cleanup(void *data)
+{
+ ngx_http_lua_main_conf_t *lmcf;
+
+ lmcf = (ngx_http_lua_main_conf_t *) data;
+
+ if (lmcf->busy_buf_ptrs) {
+ ngx_free(lmcf->busy_buf_ptrs);
+ lmcf->busy_buf_ptrs = NULL;
+ }
+}
+#endif
+
+
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
diff --git a/src/ngx_http_lua_headers.h b/src/ngx_http_lua_headers.h
index 39f1114..ee4d21c 100644
--- a/src/ngx_http_lua_headers.h
+++ b/src/ngx_http_lua_headers.h
@@ -15,6 +15,9 @@
void ngx_http_lua_inject_resp_header_api(lua_State *L);
void ngx_http_lua_inject_req_header_api(lua_State *L);
void ngx_http_lua_create_headers_metatable(ngx_log_t *log, lua_State *L);
+#if nginx_version >= 1011011
+void ngx_http_lua_ngx_raw_header_cleanup(void *data);
+#endif
#endif /* _NGX_HTTP_LUA_HEADERS_H_INCLUDED_ */
diff --git a/src/ngx_http_lua_module.c b/src/ngx_http_lua_module.c
index 3dc2817..875f933 100644
--- a/src/ngx_http_lua_module.c
+++ b/src/ngx_http_lua_module.c
@@ -28,6 +28,7 @@
#include "ngx_http_lua_ssl_certby.h"
#include "ngx_http_lua_ssl_session_storeby.h"
#include "ngx_http_lua_ssl_session_fetchby.h"
+#include "ngx_http_lua_headers.h"
static void *ngx_http_lua_create_main_conf(ngx_conf_t *cf);
@@ -624,7 +625,7 @@ ngx_http_lua_init(ngx_conf_t *cf)
volatile ngx_cycle_t *saved_cycle;
ngx_http_core_main_conf_t *cmcf;
ngx_http_lua_main_conf_t *lmcf;
-#ifndef NGX_LUA_NO_FFI_API
+#if !defined(NGX_LUA_NO_FFI_API) || nginx_version >= 1011011
ngx_pool_cleanup_t *cln;
#endif
@@ -716,6 +717,16 @@ ngx_http_lua_init(ngx_conf_t *cf)
cln->handler = ngx_http_lua_sema_mm_cleanup;
#endif
+#if nginx_version >= 1011011
+ cln = ngx_pool_cleanup_add(cf->pool, 0);
+ if (cln == NULL) {
+ return NGX_ERROR;
+ }
+
+ cln->data = lmcf;
+ cln->handler = ngx_http_lua_ngx_raw_header_cleanup;
+#endif
+
if (lmcf->lua == NULL) {
dd("initializing lua vm");
Upstream: https://github.com/openresty/lua-nginx-module/pull/1017
--- a/src/ngx_http_lua_headers.c
+++ b/src/ngx_http_lua_headers.c
@@ -77,6 +77,9 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
size_t size;
ngx_buf_t *b, *first = NULL;
ngx_int_t i, j;
+#if defined(nginx_version) && nginx_version >= 1011011
+ ngx_chain_t *cl;
+#endif
ngx_connection_t *c;
ngx_http_request_t *r, *mr;
ngx_http_connection_t *hc;
@@ -147,8 +150,15 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
if (hc->nbusy) {
b = NULL;
+
+#if defined(nginx_version) && nginx_version >= 1011011
+ for (cl = hc->busy; cl; /* void */) {
+ b = cl->buf;
+ cl = cl->next;
+#else
for (i = 0; i < hc->nbusy; i++) {
b = hc->busy[i];
+#endif
dd("busy buf: %d: [%.*s]", (int) i, (int) (b->pos - b->start),
b->start);
@@ -223,8 +233,15 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L)
}
if (hc->nbusy) {
+
+#if defined(nginx_version) && nginx_version >= 1011011
+ for (cl = hc->busy; cl; /* void */) {
+ b = cl->buf;
+ cl = cl->next;
+#else
for (i = 0; i < hc->nbusy; i++) {
b = hc->busy[i];
+#endif
if (!found) {
if (b != first) {
From 2fbc95b6ece36e01e6fea8c5691ef1611d948943 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Tue, 15 Nov 2016 18:56:30 +0100
Subject: [PATCH] Upstream: don't consider default_port when matching
upstreams.
Upstream changed API [Link 1] and removed ngx_http_upstream_srv_conf_t.default_port.
Upstream's own changeset [Link 2] suggests that the check was not needed at
all.
Link 1: http://hg.nginx.org/nginx/rev/4dea01cf49e8
Link 2: http://hg.nginx.org/nginx/rev/3fa5983b6b44
Bug: https://github.com/openresty/memc-nginx-module/issues/26
---
src/ngx_http_memc_util.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/ngx_http_memc_util.c b/src/ngx_http_memc_util.c
index 090bf43..20cb877 100644
--- a/src/ngx_http_memc_util.c
+++ b/src/ngx_http_memc_util.c
@@ -141,12 +141,14 @@ ngx_http_memc_upstream_add(ngx_http_request_t *r, ngx_url_t *url)
continue;
}
+#if defined(nginx_version) && nginx_version < 1011006
if (uscfp[i]->default_port && url->default_port
&& uscfp[i]->default_port != url->default_port)
{
dd("upstream_add: default_port not match");
continue;
}
+#endif
return uscfp[i];
}
--
2.10.2
From 2fa8ffea68498e02005e85c27e61bde30718ae3b Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@whissi.de>
Date: Sat, 11 Jun 2016 16:18:17 +0200
Subject: [PATCH 1/2] configure: Fix detection whether libcurl is linked
against gnutls
The find_curl macro is also checking whether libcurl is linked against
gnutls. However the check depends on "CURL_LIBS" which wasn't defined
by the macro.
This commit will define "CURL_LIBS" so that the check works as expected.
---
build/find_curl.m4 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/build/find_curl.m4 b/build/find_curl.m4
index 6b23ad6..3310e40 100644
--- a/build/find_curl.m4
+++ b/build/find_curl.m4
@@ -2,6 +2,7 @@ dnl Check for CURL Libraries
dnl CHECK_CURL(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
dnl Sets:
dnl CURL_CFLAGS
+dnl CURL_LDADD
dnl CURL_LIBS
CURL_CONFIG=""
@@ -57,7 +58,8 @@ if test -n "${curl_path}"; then
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl VERSION: $CURL_VERSION); fi
CURL_CFLAGS="`${CURL_CONFIG} --cflags`"
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl CFLAGS: $CURL_CFLAGS); fi
- CURL_LDADD="`${CURL_CONFIG} --libs`"
+ CURL_LIBS="`${CURL_CONFIG} --libs`"
+ CURL_LDADD="${CURL_LIBS}"
if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl LDADD: $CURL_LIBS); fi
dnl # Check version is ok
From 67f98e7da04251a40a0172e3dfac2c5a6ac6f7dd Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@whissi.de>
Date: Sat, 11 Jun 2016 16:48:58 +0200
Subject: [PATCH 2/2] configure: Move verbose_output declaration up to the
beginning
Macros like "find_curl" are using "verbose_output" variable but because some
of them are called before we define the variable we are seeing errors like
./configure: line 13855: test: : integer expression expected
This commit will fix the problem by moving the "verbose_output" declaration
up to the beginning so that the variable is available for every macro.
---
configure.ac | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7517885..0f32b01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,22 @@ AC_SUBST(MSC_REGRESSION_DOCROOT_DIR)
### Configure Options
+# Verbose output
+AC_ARG_ENABLE(verbose-output,
+ AS_HELP_STRING([--enable-verbose-output],
+ [Enable more verbose configure output.]),
+[
+ if test "$enableval" != "no"; then
+ verbose_output=1
+ else
+ verbose_output=0
+ fi
+],
+[
+ verbose_output=0
+])
+
+
#OS type
AC_CANONICAL_HOST
@@ -410,20 +426,6 @@ AC_ARG_ENABLE(errors,
report_errors=1
])
-# Verbose output
-AC_ARG_ENABLE(verbose-output,
- AS_HELP_STRING([--enable-verbose-output],
- [Enable more verbose configure output.]),
-[
- if test "$enableval" != "no"; then
- verbose_output=1
- else
- verbose_output=0
- fi
-],
-[
- verbose_output=0
-])
# Strict Compile
AC_ARG_ENABLE(strict-compile,
From d19df159043106a4d6dfd113696900b5b0dae24b Mon Sep 17 00:00:00 2001
From: Andrei Belov <defanator@gmail.com>
Date: Mon, 3 Apr 2017 12:52:01 +0300
Subject: [PATCH] Fix building with nginx >= 1.11.11
Closes SpiderLabs/ModSecurity#1359
See also:
http://hg.nginx.org/nginx/rev/e662cbf1b932
---
nginx/modsecurity/ngx_http_modsecurity.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c
index 7c13953..367b2b8 100644
--- a/nginx/modsecurity/ngx_http_modsecurity.c
+++ b/nginx/modsecurity/ngx_http_modsecurity.c
@@ -528,9 +528,15 @@ ngx_http_modsecurity_save_request_body(ngx_http_request_t *r)
hc = r->http_connection;
+#if defined(nginx_version) && nginx_version >= 1011011
+ if (hc->free && size == cscf->large_client_header_buffers.size) {
+
+ buf = hc->free->buf;
+#else
if (hc->nfree && size == cscf->large_client_header_buffers.size) {
buf = hc->free[--hc->nfree];
+#endif
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"ModSecurity: use http free large header buffer: %p %uz",
......@@ -23,7 +23,7 @@ DEVEL_KIT_MODULE_URI="https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KI
DEVEL_KIT_MODULE_WD="${WORKDIR}/ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
# ngx_brotli (https://github.com/eustas/ngx_brotli, BSD-2)
HTTP_BROTLI_MODULE_PV="8cd9dd5fc232d3a01644584921e52dae99034779"
HTTP_BROTLI_MODULE_PV="6a1174446f5a866d3d13615dd2824177570f0a69"
HTTP_BROTLI_MODULE_P="ngx_brotli-${HTTP_BROTLI_MODULE_PV}"
HTTP_BROTLI_MODULE_URI="https://github.com/eustas/ngx_brotli/archive/${HTTP_BROTLI_MODULE_PV}.tar.gz"
HTTP_BROTLI_MODULE_WD="${WORKDIR}/ngx_brotli-${HTTP_BROTLI_MODULE_PV}"
......@@ -168,7 +168,7 @@ HTTP_CT_MODULE_URI="https://github.com/grahamedgecombe/nginx-ct/archive/v${HTTP_
HTTP_CT_MODULE_WD="${WORKDIR}/nginx-ct-${HTTP_CT_MODULE_PV}"
# njs-module (https://github.com/nginx/njs, as-is)
NJS_MODULE_PV="0.1.15"
NJS_MODULE_PV="0.2.0"
NJS_MODULE_P="njs-${NJS_MODULE_PV}"
NJS_MODULE_URI="https://github.com/nginx/njs/archive/${NJS_MODULE_PV}.tar.gz"
NJS_MODULE_WD="${WORKDIR}/njs-${NJS_MODULE_PV}"
......@@ -221,8 +221,8 @@ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
RESTRICT="test"
NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif
fastcgi geo gzip limit_req limit_conn map memcached mirror proxy
referer rewrite scgi ssi split_clients upstream_hash
fastcgi geo grpc gzip limit_req limit_conn map memcached mirror
proxy referer rewrite scgi ssi split_clients upstream_hash
upstream_ip_hash upstream_keepalive upstream_least_conn
upstream_zone userid uwsgi"
NGINX_MODULES_OPT="addition auth_request dav degradation flv geoip gunzip
......@@ -347,6 +347,7 @@ DEPEND="${CDEPEND}
PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
REQUIRED_USE="pcre-jit? ( pcre )
nginx_modules_http_grpc? ( http2 )
nginx_modules_http_lua? ( nginx_modules_http_rewrite )
nginx_modules_http_naxsi? ( pcre )
nginx_modules_http_dav_ext? ( nginx_modules_http_dav )
......@@ -398,14 +399,7 @@ src_prepare() {
cd "${S}" || die
fi
if use nginx_modules_http_javascript || use nginx_modules_stream_javascript; then
cd "${NJS_MODULE_WD}" || die
eapply "${FILESDIR}"/njs-0.1.15-fix-o3-building.patch
cd "${S}" || die
fi
if use nginx_modules_http_upstream_check; then
#eapply -p0 "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/check_1.11.1+.patch
eapply -p0 "${FILESDIR}"/http_upstream_check-nginx-1.11.5+.patch
fi
......@@ -705,6 +699,11 @@ src_configure() {
WITHOUT_IPV6=" -DNGX_HAVE_INET6=0"
fi
if [[ -n "${EXTRA_ECONF}" ]]; then
myconf+=( ${EXTRA_ECONF} )
ewarn "EXTRA_ECONF applied. Now you are on your own, good luck!"
fi
./configure \
--prefix="${EPREFIX}"/usr \
--conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment