From 3f50841ccf3535558542c7af83dc7152671055ad Mon Sep 17 00:00:00 2001 From: Chingis Sandanov Date: Thu, 30 May 2024 16:37:40 +0300 Subject: [PATCH] Add 1.27, update uploadprogress --- .github/workflows/workflow.yml | 15 ++++++- Dockerfile | 17 +++---- Makefile | 2 +- README.md | 3 +- patches/1.25/uploadprogress.patch | 74 ------------------------------- patches/1.26/uploadprogress.patch | 74 ------------------------------- 6 files changed, 23 insertions(+), 162 deletions(-) delete mode 100644 patches/1.25/uploadprogress.patch delete mode 100644 patches/1.26/uploadprogress.patch diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index bc3d63f..612dcd5 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -14,6 +14,19 @@ env: DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} jobs: + nginx-127: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + with: + platforms: amd64,arm64 + - uses: docker/setup-buildx-action@v3 + - uses: ./.github/actions + with: + version: '1.27.0' + tags: 1.27,1,latest + platform: linux/amd64,linux/arm64 nginx-126: runs-on: ubuntu-latest steps: @@ -25,7 +38,7 @@ jobs: - uses: ./.github/actions with: version: '1.26.1' - tags: 1.26,1,latest + tags: '1.26' platform: linux/amd64,linux/arm64 nginx-125: runs-on: ubuntu-latest diff --git a/Dockerfile b/Dockerfile index 25c5751..3fb3d8e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,6 @@ ENV NGINX_VER="${NGINX_VER}" \ FILES_DIR="/mnt/files" \ NGINX_VHOST_PRESET="html" -COPY patches /tmp/patches - RUN set -ex; \ \ nginx_up_ver="0.9.1"; \ @@ -112,15 +110,12 @@ RUN set -ex; \ mv rules /etc/nginx/modsecurity/crs; \ \ # Get ngx upload progress module. \ - mkdir -p /tmp/ngx_http_uploadprogress_module; \ - url="https://github.com/masterzen/nginx-upload-progress-module/archive/v${nginx_up_ver}.tar.gz"; \ - wget -qO- "${url}" | tar xz --strip-components=1 -C /tmp/ngx_http_uploadprogress_module; \ - if [[ -d "/tmp/patches/${NGINX_VER%.*}" ]]; then \ - cd /tmp/ngx_http_uploadprogress_module; \ - patch -p1 -i "/tmp/patches/${NGINX_VER%.*}/uploadprogress.patch"; \ - fi; \ - \ - export GPG_KEYS=43387825DDB1BB97EC36BA5D007C8D7C15D87369; \ + cd /tmp; \ + git clone https://github.com/masterzen/nginx-upload-progress-module ngx_http_uploadprogress_module; \ + cd ngx_http_uploadprogress_module; \ + git reset --hard 85e1e8dcfbc7df73757603e3bda627ec93aff0a8; \ + \ + export GPG_KEYS=D6786CE303D9A9022998DC6CC8464D549AF75C0A; \ # Get VTS module \ git clone https://github.com/vozlt/nginx-module-vts.git /tmp/nginx_module_vts; \ cd /tmp/nginx_module_vts; \ diff --git a/Makefile b/Makefile index 9b43a27..1320524 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -include env_make -NGINX_VER ?= 1.26.1 +NGINX_VER ?= 1.27.0 NGINX_MINOR_VER ?= $(shell echo "${NGINX_VER}" | grep -oE '^[0-9]+\.[0-9]+') TAG ?= $(NGINX_MINOR_VER) diff --git a/README.md b/README.md index 0983e24..ca24a57 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ Overview: Supported tags and respective `Dockerfile` links: -- `1.26`, `1`, `latest` [_(Dockerfile)_](https://github.com/wodby/nginx/tree/master/Dockerfile) +- `1.27`, `1`, `latest` [_(Dockerfile)_](https://github.com/wodby/nginx/tree/master/Dockerfile) +- `1.26` [_(Dockerfile)_](https://github.com/wodby/nginx/tree/master/Dockerfile) - `1.25` [_(Dockerfile)_](https://github.com/wodby/nginx/tree/master/Dockerfile) All images built for `linux/amd64` and `linux/arm64` diff --git a/patches/1.25/uploadprogress.patch b/patches/1.25/uploadprogress.patch deleted file mode 100644 index 3635aa4..0000000 --- a/patches/1.25/uploadprogress.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff -pNura http-uploadprogress.orig/ngx_http_uploadprogress_module.c http-uploadprogress/ngx_http_uploadprogress_module.c ---- http-uploadprogress.orig/ngx_http_uploadprogress_module.c 2020-10-03 02:05:45.000000000 +0700 -+++ http-uploadprogress/ngx_http_uploadprogress_module.c 2022-06-24 16:24:16.196626939 +0700 -@@ -550,12 +550,12 @@ ngx_http_reportuploads_handler(ngx_http_ - ngx_chain_t out; - ngx_int_t rc, found=0, done=0, err_status=0; - off_t rest=0, length=0; -- ngx_uint_t len, i; -+ ngx_uint_t len; - ngx_slab_pool_t *shpool; - ngx_http_uploadprogress_conf_t *upcf; - ngx_http_uploadprogress_ctx_t *ctx; - ngx_http_uploadprogress_node_t *up; -- ngx_table_elt_t *expires, *cc, **ccp; -+ ngx_table_elt_t *expires, *cc; - ngx_http_uploadprogress_state_t state; - ngx_http_uploadprogress_template_t *t; - -@@ -628,6 +628,7 @@ ngx_http_reportuploads_handler(ngx_http_ - } - - r->headers_out.expires = expires; -+ expires->next = NULL; - - expires->hash = 1; - expires->key.len = sizeof("Expires") - 1; -@@ -637,37 +638,30 @@ ngx_http_reportuploads_handler(ngx_http_ - len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT"); - expires->value.len = len - 1; - -- ccp = r->headers_out.cache_control.elts; -- if (ccp == NULL) { -+ cc = r->headers_out.cache_control; - -- if (ngx_array_init(&r->headers_out.cache_control, r->pool, -- 1, sizeof(ngx_table_elt_t *)) -- != NGX_OK) { -- return NGX_HTTP_INTERNAL_SERVER_ERROR; -- } -- -- ccp = ngx_array_push(&r->headers_out.cache_control); -- if (ccp == NULL) { -- return NGX_HTTP_INTERNAL_SERVER_ERROR; -- } -+ if (cc == NULL) { - - cc = ngx_list_push(&r->headers_out.headers); - if (cc == NULL) { -+ expires->hash = 0; - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - -+ r->headers_out.cache_control = cc; -+ cc->next = NULL; -+ - cc->hash = 1; - cc->key.len = sizeof("Cache-Control") - 1; - cc->key.data = (u_char *) "Cache-Control"; - -- *ccp = cc; -- - } else { -- for (i = 1; i < r->headers_out.cache_control.nelts; i++) { -- ccp[i]->hash = 0; -+ for (cc = cc->next; cc; cc = cc->next) { -+ cc->hash = 0; - } - -- cc = ccp[0]; -+ cc = r->headers_out.cache_control; -+ cc->next = NULL; - } - - expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT"; diff --git a/patches/1.26/uploadprogress.patch b/patches/1.26/uploadprogress.patch deleted file mode 100644 index 3635aa4..0000000 --- a/patches/1.26/uploadprogress.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff -pNura http-uploadprogress.orig/ngx_http_uploadprogress_module.c http-uploadprogress/ngx_http_uploadprogress_module.c ---- http-uploadprogress.orig/ngx_http_uploadprogress_module.c 2020-10-03 02:05:45.000000000 +0700 -+++ http-uploadprogress/ngx_http_uploadprogress_module.c 2022-06-24 16:24:16.196626939 +0700 -@@ -550,12 +550,12 @@ ngx_http_reportuploads_handler(ngx_http_ - ngx_chain_t out; - ngx_int_t rc, found=0, done=0, err_status=0; - off_t rest=0, length=0; -- ngx_uint_t len, i; -+ ngx_uint_t len; - ngx_slab_pool_t *shpool; - ngx_http_uploadprogress_conf_t *upcf; - ngx_http_uploadprogress_ctx_t *ctx; - ngx_http_uploadprogress_node_t *up; -- ngx_table_elt_t *expires, *cc, **ccp; -+ ngx_table_elt_t *expires, *cc; - ngx_http_uploadprogress_state_t state; - ngx_http_uploadprogress_template_t *t; - -@@ -628,6 +628,7 @@ ngx_http_reportuploads_handler(ngx_http_ - } - - r->headers_out.expires = expires; -+ expires->next = NULL; - - expires->hash = 1; - expires->key.len = sizeof("Expires") - 1; -@@ -637,37 +638,30 @@ ngx_http_reportuploads_handler(ngx_http_ - len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT"); - expires->value.len = len - 1; - -- ccp = r->headers_out.cache_control.elts; -- if (ccp == NULL) { -+ cc = r->headers_out.cache_control; - -- if (ngx_array_init(&r->headers_out.cache_control, r->pool, -- 1, sizeof(ngx_table_elt_t *)) -- != NGX_OK) { -- return NGX_HTTP_INTERNAL_SERVER_ERROR; -- } -- -- ccp = ngx_array_push(&r->headers_out.cache_control); -- if (ccp == NULL) { -- return NGX_HTTP_INTERNAL_SERVER_ERROR; -- } -+ if (cc == NULL) { - - cc = ngx_list_push(&r->headers_out.headers); - if (cc == NULL) { -+ expires->hash = 0; - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - -+ r->headers_out.cache_control = cc; -+ cc->next = NULL; -+ - cc->hash = 1; - cc->key.len = sizeof("Cache-Control") - 1; - cc->key.data = (u_char *) "Cache-Control"; - -- *ccp = cc; -- - } else { -- for (i = 1; i < r->headers_out.cache_control.nelts; i++) { -- ccp[i]->hash = 0; -+ for (cc = cc->next; cc; cc = cc->next) { -+ cc->hash = 0; - } - -- cc = ccp[0]; -+ cc = r->headers_out.cache_control; -+ cc->next = NULL; - } - - expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";