From 5115c24f94eab7d3be8ad11e59c82494c05ce3a2 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Thu, 27 Apr 2017 00:21:50 +0200 Subject: main/nginx: upgrade to 1.12.0 Upgraded modules: * lua-nginx-module to 0.10.8 * nchan to 1.1.4 * nginx-rtmp-module to 1.1.11 --- main/nginx/echo-nginx-module~fix-nginx-1.12.patch | 211 ++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 main/nginx/echo-nginx-module~fix-nginx-1.12.patch (limited to 'main/nginx/echo-nginx-module~fix-nginx-1.12.patch') diff --git a/main/nginx/echo-nginx-module~fix-nginx-1.12.patch b/main/nginx/echo-nginx-module~fix-nginx-1.12.patch new file mode 100644 index 0000000000..9f1af70f07 --- /dev/null +++ b/main/nginx/echo-nginx-module~fix-nginx-1.12.patch @@ -0,0 +1,211 @@ +From 7740e11558b530b66b469c657576f5280b7cdb1b Mon Sep 17 00:00:00 2001 +From: Andrei Belov +Date: Wed, 22 Mar 2017 08:43:30 +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/echo-nginx-module#64 + +See also: +http://hg.nginx.org/nginx/rev/e662cbf1b932 + +Signed-off-by: Yichun Zhang (agentzh) + +Patch-Origin: Upstream's repository, master branch. +--- + src/ngx_http_echo_module.c | 13 +++++++++ + src/ngx_http_echo_module.h | 4 +++ + src/ngx_http_echo_request_info.c | 62 ++++++++++++++++++++++++++++++++++++++++ + src/ngx_http_echo_request_info.h | 3 ++ + valgrind.suppress | 10 +++++++ + 5 files changed, 92 insertions(+) + +diff --git a/src/ngx_http_echo_module.c b/src/ngx_http_echo_module.c +index ae70479..8d736d7 100644 +--- a/src/ngx_http_echo_module.c ++++ b/src/ngx_http_echo_module.c +@@ -632,6 +632,9 @@ ngx_http_echo_echo_exec(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + static void * + ngx_http_echo_create_main_conf(ngx_conf_t *cf) + { ++#if nginx_version >= 1011011 ++ ngx_pool_cleanup_t *cln; ++#endif + ngx_http_echo_main_conf_t *emcf; + + emcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_echo_main_conf_t)); +@@ -643,6 +646,16 @@ ngx_http_echo_create_main_conf(ngx_conf_t *cf) + * hmcf->requires_filter = 0; + */ + ++#if nginx_version >= 1011011 ++ cln = ngx_pool_cleanup_add(cf->pool, 0); ++ if (cln == NULL) { ++ return NULL; ++ } ++ ++ cln->data = emcf; ++ cln->handler = ngx_http_echo_request_headers_cleanup; ++#endif ++ + return emcf; + } + +diff --git a/src/ngx_http_echo_module.h b/src/ngx_http_echo_module.h +index 2d212c3..ce0a305 100644 +--- a/src/ngx_http_echo_module.h ++++ b/src/ngx_http_echo_module.h +@@ -92,6 +92,10 @@ typedef struct { + + typedef struct { + ngx_int_t requires_filter; ++#if nginx_version >= 1011011 ++ ngx_buf_t **busy_buf_ptrs; ++ ngx_int_t busy_buf_ptr_count; ++#endif + } ngx_http_echo_main_conf_t; + + +diff --git a/src/ngx_http_echo_request_info.c b/src/ngx_http_echo_request_info.c +index d28ec4d..7dd3683 100644 +--- a/src/ngx_http_echo_request_info.c ++++ b/src/ngx_http_echo_request_info.c +@@ -17,6 +17,9 @@ + + + static void ngx_http_echo_post_read_request_body(ngx_http_request_t *r); ++#if nginx_version >= 1011011 ++void ngx_http_echo_request_headers_cleanup(void *data); ++#endif + + + ngx_int_t +@@ -179,6 +182,11 @@ 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 nginx_version >= 1011011 ++ ngx_buf_t **bb; ++ ngx_chain_t *cl; ++ ngx_http_echo_main_conf_t *emcf; ++#endif + ngx_connection_t *c; + ngx_http_request_t *mr; + ngx_http_connection_t *hc; +@@ -195,6 +203,10 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, + } + #endif + ++#if nginx_version >= 1011011 ++ emcf = ngx_http_get_module_main_conf(r, ngx_http_echo_module); ++#endif ++ + size = 0; + b = c->buffer; + +@@ -215,8 +227,35 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, + + if (hc->nbusy) { + b = NULL; ++ ++#if nginx_version >= 1011011 ++ if (hc->nbusy > emcf->busy_buf_ptr_count) { ++ if (emcf->busy_buf_ptrs) { ++ ngx_free(emcf->busy_buf_ptrs); ++ } ++ ++ emcf->busy_buf_ptrs = ngx_alloc(hc->nbusy * sizeof(ngx_buf_t *), ++ r->connection->log); ++ ++ if (emcf->busy_buf_ptrs == NULL) { ++ return NGX_ERROR; ++ } ++ ++ emcf->busy_buf_ptr_count = hc->nbusy; ++ } ++ ++ bb = emcf->busy_buf_ptrs; ++ for (cl = hc->busy; cl; cl = cl->next) { ++ *bb++ = cl->buf; ++ } ++ ++ bb = emcf->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 + + if (first == NULL) { + if (mr->request_line.data >= b->pos +@@ -280,8 +319,15 @@ ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, + } + + if (hc->nbusy) { ++ ++#if nginx_version >= 1011011 ++ bb = emcf->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 + + if (!found) { + if (b != first) { +@@ -457,4 +503,20 @@ ngx_http_echo_response_status_variable(ngx_http_request_t *r, + return NGX_OK; + } + ++ ++#if nginx_version >= 1011011 ++void ++ngx_http_echo_request_headers_cleanup(void *data) ++{ ++ ngx_http_echo_main_conf_t *emcf; ++ ++ emcf = (ngx_http_echo_main_conf_t *) data; ++ ++ if (emcf->busy_buf_ptrs) { ++ ngx_free(emcf->busy_buf_ptrs); ++ emcf->busy_buf_ptrs = NULL; ++ } ++} ++#endif ++ + /* vi:set ft=c ts=4 sw=4 et fdm=marker: */ +diff --git a/src/ngx_http_echo_request_info.h b/src/ngx_http_echo_request_info.h +index 3b3713b..aa5730b 100644 +--- a/src/ngx_http_echo_request_info.h ++++ b/src/ngx_http_echo_request_info.h +@@ -29,5 +29,8 @@ ngx_int_t ngx_http_echo_request_uri_variable(ngx_http_request_t *r, + ngx_int_t ngx_http_echo_response_status_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + ++#if nginx_version >= 1011011 ++void ngx_http_echo_request_headers_cleanup(void *data); ++#endif + + #endif /* ECHO_REQUEST_INFO_H */ +diff --git a/valgrind.suppress b/valgrind.suppress +index 0f8e871..d4bfe63 100644 +--- a/valgrind.suppress ++++ b/valgrind.suppress +@@ -36,3 +36,13 @@ + 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 ++ fun:main ++} -- cgit v1.2.3