aboutsummaryrefslogtreecommitdiffstats
path: root/main/nginx
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-10-22 23:31:52 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-10-22 23:34:17 +0200
commit3865abfb5b34532f3886fdc19ef9db4472da7ccf (patch)
tree12bb536ad2af1f8cae0159846809a719ce71e8b1 /main/nginx
parent6d3b8ecfd49f101e2b618bebf4133512f87277e8 (diff)
downloadaports-3865abfb5b34532f3886fdc19ef9db4472da7ccf.tar.bz2
aports-3865abfb5b34532f3886fdc19ef9db4472da7ccf.tar.xz
main/nginx: update third-party modules
Diffstat (limited to 'main/nginx')
-rw-r--r--main/nginx/APKBUILD34
-rw-r--r--main/nginx/echo-nginx-module~fix-nginx-1.12.patch211
-rw-r--r--main/nginx/lua-nginx-module~fix-libressl.patch26
-rw-r--r--main/nginx/lua-nginx-module~fix-nginx-1.12.patch215
4 files changed, 14 insertions, 472 deletions
diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD
index 47aa25ff0d..bb24cdf742 100644
--- a/main/nginx/APKBUILD
+++ b/main/nginx/APKBUILD
@@ -30,9 +30,6 @@ subpackages="$pkgname-doc $pkgname-vim::noarch"
replaces="$pkgname-common $pkgname-initscripts $pkgname-lua $pkgname-rtmp"
source="http://nginx.org/download/$pkgname-$pkgver.tar.gz
$pkgname-tests-$_tests_hgrev.tar.gz::http://hg.nginx.org/nginx-tests/archive/$_tests_hgrev.tar.gz
- echo-nginx-module~fix-nginx-1.12.patch
- lua-nginx-module~fix-nginx-1.12.patch
- lua-nginx-module~fix-libressl.patch
nginx.conf
default.conf
$pkgname.logrotate
@@ -76,20 +73,20 @@ _add_module() {
_add_module "devel-kit" "v0.3.0" "https://github.com/simpl/ngx_devel_kit"
_devel_kit_so="ndk_http_module.so"
-_add_module "http-cache-purge" "2.4.1" "https://github.com/nginx-modules/ngx_cache_purge"
+_add_module "http-cache-purge" "2.4.2" "https://github.com/nginx-modules/ngx_cache_purge"
-_add_module "http-echo" "v0.60" "https://github.com/openresty/echo-nginx-module"
+_add_module "http-echo" "v0.61" "https://github.com/openresty/echo-nginx-module"
-_add_module "http-fancyindex" "v0.4.1" "https://github.com/aperezdc/ngx-fancyindex"
+_add_module "http-fancyindex" "v0.4.2" "https://github.com/aperezdc/ngx-fancyindex"
_add_module "http-headers-more" "v0.32" "https://github.com/openresty/headers-more-nginx-module"
_http_headers_more_so="ngx_http_headers_more_filter_module.so"
-_add_module "http-lua" "v0.10.8" "https://github.com/openresty/lua-nginx-module"
+_add_module "http-lua" "v0.10.10" "https://github.com/openresty/lua-nginx-module"
_http_lua_depends="$pkgname-mod-devel-kit"
_http_lua_provides="$pkgname-lua" # for backward compatibility
-_add_module "http-lua-upstream" "v0.06" "https://github.com/openresty/lua-upstream-nginx-module"
+_add_module "http-lua-upstream" "v0.07" "https://github.com/openresty/lua-upstream-nginx-module"
_http_lua_upstream_depends="$pkgname-mod-http-lua"
_add_module "http-nchan" "v1.1.7" "https://github.com/slact/nchan"
@@ -105,9 +102,9 @@ _http_set_misc_depends="$pkgname-mod-devel-kit"
_add_module "http-upload-progress" "v0.9.2" "https://github.com/masterzen/nginx-upload-progress-module"
_http_upload_progress_so="ngx_http_uploadprogress_module.so"
-_add_module "http-upstream-fair" "v0.1.2" "https://github.com/itoffshore/nginx-upstream-fair"
+_add_module "http-upstream-fair" "0.1.3" "https://github.com/itoffshore/nginx-upstream-fair"
-_add_module "rtmp" "v1.1.11" "https://github.com/arut/nginx-rtmp-module"
+_add_module "rtmp" "v1.2.0" "https://github.com/arut/nginx-rtmp-module"
_rtmp_provides="$pkgname-rtmp" # for backward compatibility
@@ -268,24 +265,21 @@ _module() {
sha512sums="3faa2043e237a7e1d15cc5661ac9d002a965220a78c25a863be9f19e01007347e53f776b61c229f6bd3d916cc1ccf92de260811f7b8092ec1b747fba7c0061f7 nginx-1.12.2.tar.gz
ca8be839aef71c537d6d3a79e2894f38790834d6310c6d15ad06900c7c2d7cf71a113847ab96ef9be0fbdfff3b7808e74dea427502b275cfd6c909550f9ba9ab nginx-tests-cdd44ff602db.tar.gz
-401f57ed73941619cdd41061bd92fffc00730e34cc647ea3c9345225723e9c7ebd72d9d15a703cffd93b0a99d458a05fe5efa7373ae24f41b35279285b5ca0fa echo-nginx-module~fix-nginx-1.12.patch
-04f7d75ce15eba99be99a76d266903c17e48742ab4bf237b988bf84f00cdbf6510c3d4eee88a24620e56dc426220192df39f4736af157fdc4e4c50b4f1d794f2 lua-nginx-module~fix-nginx-1.12.patch
-fd8bce0e7d69552267b8e405b07fc9323e25e06cceb8912a2d143952447a4299756e6a9a8a40f4eabe8b00fed475fd87ee4a982f5ad7449d59783e872c682451 lua-nginx-module~fix-libressl.patch
ac7e3153ab698b4cde077f0d5d7ac0a58897927eb36cf3b58cb01268ca0296f1d589c0a5b4f889b96b5b4a57bef05b17c59be59a9d7c4d7a3d3be58f101f7f41 nginx.conf
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3 default.conf
09b110693e3f4377349ccea3c43cb8199c8579ee351eae34283299be99fdf764b0c1bddd552e13e4d671b194501618b29c822e1ad53b34101a73a63954363dbb nginx.logrotate
eb183860cd511361346e4079c1fcf470985e1c3b2a034a57f8b2a92ba851fed99256261f9b779770a5f57e3750e9e71bd1550a9d19ad9bf3a4d288864f0374a2 nginx.initd
558764c9be913a4f61d0e277d07bf3c272e1ce086b3fadb85b693a7e92805cd9fca4da7a8d29c96e53fc0d23b331327d3b2561ff61f19d2330e7d5d35ac7d614 ngx_devel_kit-0.3.0.tar.gz
-1134d404ec9fd163d410c6ac6d8ec55515586e470aad17f1909e23c4fd35217a39639fa24cdffcf3b32733bb83c5f47508e16fb22f9d2c42e8226bda51b4ae38 ngx_cache_purge-2.4.1.tar.gz
-c455bee73cebd0752449472452d15614b9587ddd199263d366484ede890c4d108eacbbeaef31adc9dc7732b56ef2bfc73c0fef3366366db03a8ec3fdc27a985c echo-nginx-module-0.60.tar.gz
-ce0043ad4a2b638c5d99244d6caaa65ad142cea78884084a9aeca5a9593c68dbe508c9e4dd85dc5722eb63ef386612bffc48d4b6fc1487df244fbcb7a73bffe1 ngx-fancyindex-0.4.1.tar.gz
+1c2e6f5026becbd7bdf9feb920f10c19c6c5487600008161b045e9d6b5ea0269af68a2869e57b528bc921d549c541e6dbb02eb2ef26416a22d5d5a7f3ffc552b ngx_cache_purge-2.4.2.tar.gz
+c90b81a4e85a8e9beeb5ff591dc91adb25fa4e0b6cb47086b577e5fa36db2368442dd011187675e358781956c364b949bc4d920ca2b534481b21c9987d2a9a3b echo-nginx-module-0.61.tar.gz
+aee121e4d25872f0eee6c8150c8c732767ab24c61dc4f6e3f86bd6edc53ad715f3c23045362954a1ad2086ff1002bca821b2e9a53b58b077cbda91a95077ef76 ngx-fancyindex-0.4.2.tar.gz
e42582b45c3111de3940bbeb67ce161aca2d55adcfb00c61c12256fa0e36221d38723013f36edbcf6d1b520f8dfb49d4657df8a956e66d36e68425afad382bd1 headers-more-nginx-module-0.32.tar.gz
-ad621cec178eb37109f16ebc30dbab7b1ea344ac4b523ff1e6ad62364b8cf437488a89c593ca44b446b729a1c578e3a97685851847b4b16a147ac9eca8f23a2a lua-nginx-module-0.10.8.tar.gz
-eee427887b172cde32f42c5b2158fb1e05742b102b996e48e99941a9c1a33ec7d473a8835c1d06686c02afeb5d5dbe0fec8ff700a363d6330821f108196e85da lua-upstream-nginx-module-0.06.tar.gz
+3440e3fe714407f0ff61e0da207669655b443f7b70ef8a91693ea05ed96d8fde349d9c8ea30d5ff53ea3f8e4a5c7d0a2834e136c340b1b1365d62006339a1e4d lua-nginx-module-0.10.10.tar.gz
+72887c4490854b099cb26bb3f840073a36b0d812bde4486f04dc1be182ca74f0d1e3fd709e77c240c2dcf37665f74cf04e188ea9efe8e127c6789b27b487d0cd lua-upstream-nginx-module-0.07.tar.gz
1e9b029912ef6e89dba8e3aed57d50848b52fbeb1077d965ca39aea14c2b34c11092ee53db47fb1df9e5adaf466f849c5a33cade881fddb420c1a036bc659d4b nchan-1.1.7.tar.gz
1730845ea2e52be8c2f6cfceb2894304c5a07959a96940bb1617ee0e7cf81d22283304f411d9a219ddb71e4d9a66012bba0f6f5574d101aeb3c406f26c5d6a4e nginx-http-shibboleth-2.0.1.tar.gz
a22cfab85f5a15cf4b778749227caee559982dbe7711e1c5698456b3821943ec66b7a980ed56612b7f2ae70d22832123be24e50a402c659c6f3eb1d98d60b4cd redis2-nginx-module-0.14.tar.gz
c853b041cecc3521f888be3d0483c6cf23d239259ac4f5d35b10d4483b0fb06d1d22060adedcf6605b220d99f9051faf300d06989736d510b4486f943d3a675e set-misc-nginx-module-0.31.tar.gz
c31c46344d49704389722325a041b9cd170fa290acefe92cfc572c07f711cd3039de78f28df48ca7dcb79b2e4bbe442580aaaf4d92883fd3a14bf41d66dd9d8c nginx-upload-progress-module-0.9.2.tar.gz
-4da7734301d21cd696fcc3aed1a496a93be15af373307487622c0a5920e79d9b580fd5836de7f9c0b60c01485021ba85afae1abb471e703c2d6e23c60ffe7d0a nginx-upstream-fair-0.1.2.tar.gz
-e7c897265d1e93b06f7e46a653b113e24d2451e2112a7a6da415f130928437444a0346832fd9c10042397fea6120e4e44acc2bccf649ec30ca5bffbf985672e2 nginx-rtmp-module-1.1.11.tar.gz"
+8adb7453c27748f4e685e3352e9b318b408da818754dc5b6244e908423941a8ba337561104f6e481f2553cbc0e334dcea73b57f8e810a9d6e974bb69ff8859e5 nginx-upstream-fair-0.1.3.tar.gz
+8965d9bee91a46375516ccd012d1c43cd23f15c0630d11ed01472b9a84504574b476f22c5584f43c972a8f923e9ae025b9b60c64aace0ed159c7279bcbd376c8 nginx-rtmp-module-1.2.0.tar.gz"
diff --git a/main/nginx/echo-nginx-module~fix-nginx-1.12.patch b/main/nginx/echo-nginx-module~fix-nginx-1.12.patch
deleted file mode 100644
index 9f1af70f07..0000000000
--- a/main/nginx/echo-nginx-module~fix-nginx-1.12.patch
+++ /dev/null
@@ -1,211 +0,0 @@
-From 7740e11558b530b66b469c657576f5280b7cdb1b Mon Sep 17 00:00:00 2001
-From: Andrei Belov <defanator@gmail.com>
-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) <agentzh@gmail.com>
-
-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
- }
-+{
-+ <insert_a_suppression_name_here>
-+ Memcheck:Leak
-+ match-leak-kinds: definite
-+ fun:malloc
-+ fun:ngx_alloc
-+ fun:ngx_set_environment
-+ fun:ngx_single_process_cycle
-+ fun:main
-+}
diff --git a/main/nginx/lua-nginx-module~fix-libressl.patch b/main/nginx/lua-nginx-module~fix-libressl.patch
deleted file mode 100644
index 21a73c1050..0000000000
--- a/main/nginx/lua-nginx-module~fix-libressl.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 7206c8f6fe10136e458d4b3c7ae2b696bd4c8983 Mon Sep 17 00:00:00 2001
-From: Alessandro Ghedini <alessandro@cloudflare.com>
-Date: Thu, 12 May 2016 13:17:52 +0100
-Subject: [PATCH 3/6] bugfix: ssl: do not set tlsext_status_expected flag
-
-In OpenSSL 1.1.0 the SSL struct was made opaque, and setting this
-flag manually is not required anyway since OpenSSL already does that
-automatically when ngx_http_lua_ssl_empty_status_callback() returns
-"OK" (which is always), and an OCSP response has been set.
-
-Upstream-Issue: https://github.com/openresty/lua-nginx-module/pull/761
----
- src/ngx_http_lua_ssl_ocsp.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/src/ngx_http_lua_ssl_ocsp.c b/src/ngx_http_lua_ssl_ocsp.c
-index 3904aa8..31b4f24 100644
---- a/src/ngx_http_lua_ssl_ocsp.c
-+++ b/src/ngx_http_lua_ssl_ocsp.c
-@@ -490,7 +490,6 @@ ngx_http_lua_ffi_ssl_set_ocsp_status_resp(ngx_http_request_t *r,
-
- dd("set ocsp resp: resp_len=%d", (int) resp_len);
- (void) SSL_set_tlsext_status_ocsp_resp(ssl_conn, p, resp_len);
-- ssl_conn->tlsext_status_expected = 1;
-
- return NGX_OK;
diff --git a/main/nginx/lua-nginx-module~fix-nginx-1.12.patch b/main/nginx/lua-nginx-module~fix-nginx-1.12.patch
deleted file mode 100644
index d81669716b..0000000000
--- a/main/nginx/lua-nginx-module~fix-nginx-1.12.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-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
-
-Patch-Origin: Upstream's repository, master branch.
----
- 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");
-