aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlauren n. liberda <lauren@selfisekai.rocks>2024-03-20 17:07:26 +0100
committerlauren n. liberda <lauren@selfisekai.rocks>2024-03-20 20:32:30 +0100
commit92af3e7acbeabff885976f306a0c035805898b69 (patch)
tree219638bbeb47c3479bb8f8717da0b1569baeb52b
parente618fdf22cf9abbc12901ec2535096a13bb378cb (diff)
main/nginx: add http-zstd module
-rw-r--r--main/nginx/APKBUILD10
-rw-r--r--main/nginx/zstd-nginx-module~fix-infinite-loop.patch47
2 files changed, 56 insertions, 1 deletions
diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD
index 10b34ed7e76..d6240bc1499 100644
--- a/main/nginx/APKBUILD
+++ b/main/nginx/APKBUILD
@@ -37,7 +37,7 @@ pkgname=nginx
# NOTE: Upgrade only to even-numbered versions (e.g. 1.14.z, 1.16.z)!
# Odd-numbered versions are mainline (development) versions.
pkgver=1.24.0
-pkgrel=17
+pkgrel=18
# Revision of nginx-tests to use for check().
_tests_hgrev=22f45bf99a9e
_njs_ver=0.8.3
@@ -64,6 +64,8 @@ makedepends="
pkgconf
zeromq-dev
zlib-dev
+ zstd-dev
+ !zstd-static
"
checkdepends="
gd
@@ -103,6 +105,7 @@ source="https://nginx.org/download/nginx-$pkgver.tar.gz
nchan~fix-redis-race-condition.patch
nginx-upload-module~fixes.patch
nginx-upload-module~fix-nginx-compat.patch
+ zstd-nginx-module~fix-infinite-loop.patch
nginx.conf
default.conf
stream.conf
@@ -245,6 +248,9 @@ _http_vts_so="ngx_http_vhost_traffic_status_module.so"
_add_module "http-zip" "1.3.0" "https://github.com/evanmiller/mod_zip"
+_add_module "http-zstd" "0.1.1" "https://github.com/tokers/zstd-nginx-module"
+_http_zstd_so="ngx_http_zstd_filter_module.so ngx_http_zstd_static_module.so"
+
_add_module "rtmp" "v1.2.2" "https://github.com/arut/nginx-rtmp-module"
_rtmp_provides="$pkgname-rtmp" # for backward compatibility
@@ -511,6 +517,7 @@ abda15727e34178db2f8013a1c47e480ba323a3b3b88a44bbada0169b8ce66743911ec7b551272fc
2a87aee322a146a55e58d48636cdb6a3a182c308a6fe5327c9c2ece0487f669fe6b3f231f56e395e12b7c2ae2dd929a72a03dc18b1032ccc733184aac50d2381 nchan~fix-redis-race-condition.patch
ef57603bd65ffbbb216fd748dab0126d3df7aafdfa70dce0ea9ef91373df95269546ec2fcaa03f842a8db3a16879274184a23b18db17b4f9be3916aedacb7765 nginx-upload-module~fixes.patch
bae6c3153810bf6f460248668f2c48e332aba37081e25e45a1691344508530ef1be9acee4d52f506cb09510c4fce8d93ca3178ba45af771c54e37126f4f11b1b nginx-upload-module~fix-nginx-compat.patch
+97ed3a3ad636a8853a993db3a33c67da303063e7ac43c20eeac6afb9f71adafa5dedf5f5f8c6705a256294c0566e3ac9f5fa41930048ad80b10a7d2a7d3c9b53 zstd-nginx-module~fix-infinite-loop.patch
c209a220b6afc9354a1c4c39817199327425485b3da44778d632cdfd1d95b8412c58ba9b27a5c96599e7a34cc039f5b7d914ad82153c610b27dfbe21fdcdca77 nginx.conf
0907f69dc2d3dc1bad3a04fb6673f741f1a8be964e22b306ef9ae2f8e736e1f5733a8884bfe54f3553fff5132a0e5336716250f54272c3fec2177d6ba16986f3 default.conf
426f0c317322af7cab152f2070398c7aa5c059276ba504617a212f1e060bbb1dd9edc54e62d4cf5f14e3678235351c808ebeabe8b122757c74b3f505e8427106 stream.conf
@@ -547,5 +554,6 @@ c31c46344d49704389722325a041b9cd170fa290acefe92cfc572c07f711cd3039de78f28df48ca7
29ef77f1bbdb2410ff317ebdd7434f31b8ec370ae6b617b92e745e87c11bc820b451181d1d2b57156b414348da14ac448b689b32b17ab418144292eda094512d nginx-vod-module-1.33.tar.gz
7295c1af3267b067793fb88e3d3a74fdba5187742141d447f597b8d726c455bfb163209eca5d00b00a57adc3f627078b404a43f5318f910a68c6aeaffb189b1c nginx-module-vts-0.2.2.tar.gz
8c5dda14da06ef776fe2b496c2f1b80d2c25c9269309aa560a006c369044c52917024a90f897b7212b2409a874bf2e0a3ab2dbc1e10ad84fa64f54f1f4df3d0d mod_zip-1.3.0.tar.gz
+6feb544face95121ea076db5df8ca34854085b57602e732c7ba427be5e3f2bf668729d45497a2c91212f98ed8a2c347aa8778a54594f5d241e39e094a2556e4c zstd-nginx-module-0.1.1.tar.gz
3f8c803221854c4b1a06aadc6313fbfec74bd7179c0ee51d4365b26ffa8875881a6e1e48f777a9c9efbb9170ab7478a82920d5448a2c2df485503d37bb03ab81 nginx-rtmp-module-1.2.2.tar.gz
"
diff --git a/main/nginx/zstd-nginx-module~fix-infinite-loop.patch b/main/nginx/zstd-nginx-module~fix-infinite-loop.patch
new file mode 100644
index 00000000000..7f71271681a
--- /dev/null
+++ b/main/nginx/zstd-nginx-module~fix-infinite-loop.patch
@@ -0,0 +1,47 @@
+patch-source: https://github.com/tokers/zstd-nginx-module/pull/23
+
+From 7f86e5bbd7711b216688c418ffe2a64c9b25f319 Mon Sep 17 00:00:00 2001
+From: drawing <cppbreak@qq.com>
+Date: Mon, 12 Jun 2023 14:37:00 +0800
+Subject: [PATCH] bugfix: fix zstd module infinite loop when upstream return
+ content-length abnormal
+
+---
+ filter/ngx_http_zstd_filter_module.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/filter/ngx_http_zstd_filter_module.c b/filter/ngx_http_zstd_filter_module.c
+index d5784ba..cea386f 100644
+--- a/filter/ngx_http_zstd_filter_module.c
++++ b/filter/ngx_http_zstd_filter_module.c
+@@ -440,6 +440,8 @@ ngx_http_zstd_filter_compress(ngx_http_request_t *r, ngx_http_zstd_ctx_t *ctx)
+ ctx->out_buf->last += ctx->buffer_out.pos - pos_out;
+ ctx->redo = 0;
+
++ unsigned last_action = ctx->action;
++
+ if (rc > 0) {
+ if (ctx->action == NGX_HTTP_ZSTD_FILTER_COMPRESS) {
+ ctx->action = NGX_HTTP_ZSTD_FILTER_FLUSH;
+@@ -459,7 +461,7 @@ ngx_http_zstd_filter_compress(ngx_http_request_t *r, ngx_http_zstd_ctx_t *ctx)
+ ctx->action = NGX_HTTP_ZSTD_FILTER_COMPRESS; /* restore */
+ }
+
+- if (ngx_buf_size(ctx->out_buf) == 0) {
++ if (ngx_buf_size(ctx->out_buf) == 0 && last_action != NGX_HTTP_ZSTD_FILTER_FLUSH) {
+ return NGX_AGAIN;
+ }
+
+@@ -469,6 +471,12 @@ ngx_http_zstd_filter_compress(ngx_http_request_t *r, ngx_http_zstd_ctx_t *ctx)
+ }
+
+ b = ctx->out_buf;
++ if (ngx_buf_size(b) == 0) {
++ b = ngx_calloc_buf(ctx->request->pool);
++ if (b == NULL) {
++ return NGX_ERROR;
++ }
++ }
+
+ if (rc == 0 && (ctx->flush || ctx->last)) {
+ r->connection->buffered &= ~NGX_HTTP_GZIP_BUFFERED;