git: 7e98f0cfd0b8 - main - www/{nginx-devel,freenginx}: 3rd-party modules management

From: Jochen Neumeister <joneum_at_FreeBSD.org>
Date: Sat, 08 Aug 2026 22:30:24 UTC
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7e98f0cfd0b84c170bedb15a4136e520b3cc3bca

commit 7e98f0cfd0b84c170bedb15a4136e520b3cc3bca
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-08-08 22:24:28 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-08-08 22:30:15 +0000

    www/{nginx-devel,freenginx}: 3rd-party modules management
    
    The nginx_upstream_check_module extra-patches no longer matched the
    current sources, so builds with HTTP_UPSTREAM_CHECK enabled failed.
    
    nginx-devel: refresh the ngx_http_upstream_round_robin.c extra-patch for
    nginx 1.31; reuse the patch already carried by www/nginx.
    
    freenginx: regenerate the round_robin extra-patch against freenginx's
    sources, and add extra-patch-ngx_http_upstream_check_module.c which
    replaces the module's use of the ngx_http_status_t 'count' member
    (removed in freenginx) with a local variable.
    
    PR:             295745
    Sponsored by:   Netzkommune GmbH
---
 www/freenginx/Makefile                             |   2 +-
 www/freenginx/Makefile.extmod                      |   3 +-
 .../extra-patch-ngx_http_upstream_check_module.c   |  54 ++++++++++
 ...-patch-src-http-ngx_http_upstream_round_robin.c |  46 +++++----
 www/nginx-devel/Makefile                           |   2 +-
 ...-patch-src-http-ngx_http_upstream_round_robin.c | 115 ++++++++++++++-------
 6 files changed, 158 insertions(+), 64 deletions(-)

diff --git a/www/freenginx/Makefile b/www/freenginx/Makefile
index 81816580ab3d..6278e0c55b9e 100644
--- a/www/freenginx/Makefile
+++ b/www/freenginx/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	freenginx
 PORTVERSION=	1.30.1
-PORTREVISION?=	5
+PORTREVISION?=	6
 CATEGORIES=	www
 MASTER_SITES=	https://freenginx.org/download/ \
 		LOCAL/joneum
diff --git a/www/freenginx/Makefile.extmod b/www/freenginx/Makefile.extmod
index 40180b13b9af..69a41b538e45 100644
--- a/www/freenginx/Makefile.extmod
+++ b/www/freenginx/Makefile.extmod
@@ -176,7 +176,8 @@ HTTP_UPSTREAM_CHECK_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-src-http-modules-ngx_
 					${PATCHDIR}/extra-patch-src-http-modules-ngx_http_upstream_ip_hash_module.c \
 					${PATCHDIR}/extra-patch-src-http-modules-ngx_http_upstream_least_conn_module.c \
 					${PATCHDIR}/extra-patch-src-http-ngx_http_upstream_round_robin.c \
-					${PATCHDIR}/extra-patch-src-http-ngx_http_upstream_round_robin.h
+					${PATCHDIR}/extra-patch-src-http-ngx_http_upstream_round_robin.h \
+					${PATCHDIR}/extra-patch-ngx_http_upstream_check_module.c
 
 HTTP_UPSTREAM_FAIR_GH_TUPLE=		jaygooby:nginx-upstream-fair:10ecdcf:upstreamfair
 HTTP_UPSTREAM_FAIR_VARS=		DSO_EXTMODS+=upstreamfair
diff --git a/www/freenginx/files/extra-patch-ngx_http_upstream_check_module.c b/www/freenginx/files/extra-patch-ngx_http_upstream_check_module.c
new file mode 100644
index 000000000000..4224ff098c0c
--- /dev/null
+++ b/www/freenginx/files/extra-patch-ngx_http_upstream_check_module.c
@@ -0,0 +1,54 @@
+--- ../nginx_upstream_check_module-9aecf15/ngx_http_upstream_check_module.c.orig
++++ ../nginx_upstream_check_module-9aecf15/ngx_http_upstream_check_module.c
+@@ -1844,6 +1844,7 @@
+ ngx_http_upstream_check_parse_fastcgi_status(ngx_http_upstream_check_ctx_t *ctx,
+     ngx_buf_t *b, ngx_http_status_t *status)
+ {
++    ngx_uint_t count = 0;
+     u_char      c, ch, *p, *name_s, *name_e;
+     ngx_flag_t  find;
+ 
+@@ -1870,7 +1871,7 @@
+         "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+         "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+ 
+-    status->count = 0;
++    count = 0;
+     status->code = 0;
+     find = 0;
+     name_s = name_e = NULL;
+@@ -1979,7 +1980,7 @@
+                     }
+ 
+                     status->code = status->code * 10 + ch - '0';
+-                    if (status->count++ != 0) {
++                    if (count++ != 0) {
+                         return NGX_ERROR;
+                     }
+                 }
+@@ -1999,7 +2000,7 @@
+ 
+                 status->code = status->code * 10 + ch - '0';
+ 
+-                if (++status->count == 3) {
++                if (++count == 3) {
+                     return NGX_DONE;
+                 }
+             }
+@@ -2097,6 +2098,7 @@
+ ngx_http_upstream_check_parse_status_line(ngx_http_upstream_check_ctx_t *ctx,
+     ngx_buf_t *b, ngx_http_status_t *status)
+ {
++    ngx_uint_t count = 0;
+     u_char ch, *p;
+     enum {
+         sw_start = 0,
+@@ -2218,7 +2220,7 @@
+ 
+             status->code = status->code * 10 + ch - '0';
+ 
+-            if (++status->count == 3) {
++            if (++count == 3) {
+                 state = sw_space_after_status;
+                 status->start = p - 2;
+             }
diff --git a/www/freenginx/files/extra-patch-src-http-ngx_http_upstream_round_robin.c b/www/freenginx/files/extra-patch-src-http-ngx_http_upstream_round_robin.c
index e5012b098309..a2582138fb1e 100644
--- a/www/freenginx/files/extra-patch-src-http-ngx_http_upstream_round_robin.c
+++ b/www/freenginx/files/extra-patch-src-http-ngx_http_upstream_round_robin.c
@@ -1,4 +1,4 @@
---- src/http/ngx_http_upstream_round_robin.c.orig	2016-02-24 14:53:24 UTC
+--- src/http/ngx_http_upstream_round_robin.c.orig
 +++ src/http/ngx_http_upstream_round_robin.c
 @@ -9,6 +9,9 @@
  #include <ngx_core.h>
@@ -8,9 +8,9 @@
 +#include "ngx_http_upstream_check_module.h"
 +#endif
  
- #define ngx_http_upstream_tries(p) ((p)->number                               \
-                                     + ((p)->next ? (p)->next->number : 0))
-@@ -96,7 +99,14 @@ ngx_http_upstream_init_round_robin(ngx_c
+ #define ngx_http_upstream_tries(p) ((p)->tries                                \
+                                     + ((p)->next ? (p)->next->tries : 0))
+@@ -103,7 +106,14 @@
                  peer[n].fail_timeout = server[i].fail_timeout;
                  peer[n].down = server[i].down;
                  peer[n].server = server[i].name;
@@ -26,7 +26,7 @@
                  *peerp = &peer[n];
                  peerp = &peer[n].next;
                  n++;
-@@ -159,7 +169,15 @@ ngx_http_upstream_init_round_robin(ngx_c
+@@ -173,7 +183,15 @@
                  peer[n].fail_timeout = server[i].fail_timeout;
                  peer[n].down = server[i].down;
                  peer[n].server = server[i].name;
@@ -43,8 +43,8 @@
                  *peerp = &peer[n];
                  peerp = &peer[n].next;
                  n++;
-@@ -225,6 +243,9 @@ ngx_http_upstream_init_round_robin(ngx_c
-         peer[i].current_weight = 0;
+@@ -241,6 +259,9 @@
+         peer[i].max_conns = 0;
          peer[i].max_fails = 1;
          peer[i].fail_timeout = 10;
 +#if (NGX_HTTP_UPSTREAM_CHECK)
@@ -53,27 +53,27 @@
          *peerp = &peer[i];
          peerp = &peer[i].next;
      }
-@@ -339,6 +360,9 @@ ngx_http_upstream_create_round_robin_pee
-         peer[0].current_weight = 0;
-         peer[0].max_fails = 1;
-         peer[0].fail_timeout = 10;
+@@ -358,6 +379,9 @@
+         peer[0].max_conns = 0;
+         peer[0].max_fails = 0;
+         peer[0].fail_timeout = 0;
 +#if (NGX_HTTP_UPSTREAM_CHECK)
 +        peer[0].check_index = (ngx_uint_t) NGX_ERROR;
 +#endif
          peers->peer = peer;
  
      } else {
-@@ -381,6 +405,9 @@ ngx_http_upstream_create_round_robin_pee
-             peer[i].current_weight = 0;
-             peer[i].max_fails = 1;
-             peer[i].fail_timeout = 10;
+@@ -392,6 +416,9 @@
+             peer[i].max_conns = 0;
+             peer[i].max_fails = 0;
+             peer[i].fail_timeout = 0;
 +#if (NGX_HTTP_UPSTREAM_CHECK)
 +            peer[i].check_index = (ngx_uint_t) NGX_ERROR;
 +#endif
              *peerp = &peer[i];
              peerp = &peer[i].next;
          }
-@@ -441,6 +468,12 @@ ngx_http_upstream_get_round_robin_peer(n
+@@ -457,6 +484,12 @@
              goto failed;
          }
  
@@ -86,16 +86,18 @@
          rrp->current = peer;
  
      } else {
-@@ -542,6 +575,12 @@ ngx_http_upstream_get_peer(ngx_http_upst
-             continue;
+@@ -548,8 +581,14 @@
          }
  
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
+         if (peer->down) {
 +            continue;
 +        }
-+#endif
 +
++#if (NGX_HTTP_UPSTREAM_CHECK)
++        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
+             continue;
+         }
++#endif
+ 
          if (peer->max_fails
              && peer->fails >= peer->max_fails
-             && now - peer->checked <= peer->fail_timeout)
diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile
index 2876b5667b1c..1e30fe3e8de2 100644
--- a/www/nginx-devel/Makefile
+++ b/www/nginx-devel/Makefile
@@ -1,7 +1,7 @@
 PORTNAME?=	nginx
 PORTVERSION=	${NGINX_VERSION}
 .include "version.mk"
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www
 MASTER_SITES=	https://nginx.org/download/ \
 		LOCAL/osa
diff --git a/www/nginx-devel/files/extra-patch-src-http-ngx_http_upstream_round_robin.c b/www/nginx-devel/files/extra-patch-src-http-ngx_http_upstream_round_robin.c
index e5012b098309..b2588f7a9ff4 100644
--- a/www/nginx-devel/files/extra-patch-src-http-ngx_http_upstream_round_robin.c
+++ b/www/nginx-devel/files/extra-patch-src-http-ngx_http_upstream_round_robin.c
@@ -1,50 +1,86 @@
---- src/http/ngx_http_upstream_round_robin.c.orig	2016-02-24 14:53:24 UTC
-+++ src/http/ngx_http_upstream_round_robin.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
+--- src/http/ngx_http_upstream_round_robin.c.orig
++++ src/http/ngx_http_upstream_round_robin.c	2026-05-04 16:03:21.659464946 +0000
+@@ -10,6 +10,10 @@
  #include <ngx_http.h>
+ #include <ngx_md5.h>
  
 +#if (NGX_HTTP_UPSTREAM_CHECK)
 +#include "ngx_http_upstream_check_module.h"
 +#endif
++
  
- #define ngx_http_upstream_tries(p) ((p)->number                               \
-                                     + ((p)->next ? (p)->next->number : 0))
-@@ -96,7 +99,14 @@ ngx_http_upstream_init_round_robin(ngx_c
-                 peer[n].fail_timeout = server[i].fail_timeout;
+ #define ngx_http_upstream_tries(p) ((p)->tries                                \
+                                     + ((p)->next ? (p)->next->tries : 0))
+@@ -196,6 +200,16 @@
+                 peer[n].down = server[i].down;
+                 peer[n].server = server[i].name;
+ 
++#if (NGX_HTTP_UPSTREAM_CHECK)
++                if (!server[i].down) {
++                    peer[n].check_index =
++                        ngx_http_upstream_check_add_peer(cf, us,
++                                                         &server[i].addrs[0]);
++                } else {
++                    peer[n].check_index = (ngx_uint_t) NGX_ERROR;
++                }
++#endif
++
+ #if (NGX_HTTP_UPSTREAM_SID)
+                 if (ngx_http_upstream_create_sid(cf, &peer[n], &server[i].sid)
+                     != NGX_OK)
+@@ -225,6 +239,16 @@
                  peer[n].down = server[i].down;
                  peer[n].server = server[i].name;
--
+ 
 +#if (NGX_HTTP_UPSTREAM_CHECK)
 +                if (!server[i].down) {
 +                    peer[n].check_index =
-+                        ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++                        ngx_http_upstream_check_add_peer(cf, us,
++                                                         &server[i].addrs[j]);
 +                } else {
 +                    peer[n].check_index = (ngx_uint_t) NGX_ERROR;
 +                }
 +#endif
-                 *peerp = &peer[n];
-                 peerp = &peer[n].next;
-                 n++;
-@@ -159,7 +169,15 @@ ngx_http_upstream_init_round_robin(ngx_c
-                 peer[n].fail_timeout = server[i].fail_timeout;
++
+ #if (NGX_HTTP_UPSTREAM_SID)
+                 if (ngx_http_upstream_create_sid(cf, &peer[n], &server[i].sid)
+                     != NGX_OK)
+@@ -338,6 +362,16 @@
                  peer[n].down = server[i].down;
                  peer[n].server = server[i].name;
--
+ 
 +#if (NGX_HTTP_UPSTREAM_CHECK)
 +                if (!server[i].down) {
 +                    peer[n].check_index =
-+                        ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++                        ngx_http_upstream_check_add_peer(cf, us,
++                                                         &server[i].addrs[0]);
++                } else {
++                    peer[n].check_index = (ngx_uint_t) NGX_ERROR;
 +                }
-+                else {
++#endif
++
+ #if (NGX_HTTP_UPSTREAM_SID)
+                 if (ngx_http_upstream_create_sid(cf, &peer[n], &server[i].sid)
+                     != NGX_OK)
+@@ -367,6 +401,16 @@
+                 peer[n].down = server[i].down;
+                 peer[n].server = server[i].name;
+ 
++#if (NGX_HTTP_UPSTREAM_CHECK)
++                if (!server[i].down) {
++                    peer[n].check_index =
++                        ngx_http_upstream_check_add_peer(cf, us,
++                                                         &server[i].addrs[j]);
++                } else {
 +                    peer[n].check_index = (ngx_uint_t) NGX_ERROR;
 +                }
 +#endif
-                 *peerp = &peer[n];
-                 peerp = &peer[n].next;
-                 n++;
-@@ -225,6 +243,9 @@ ngx_http_upstream_init_round_robin(ngx_c
-         peer[i].current_weight = 0;
++
+ #if (NGX_HTTP_UPSTREAM_SID)
+                 if (ngx_http_upstream_create_sid(cf, &peer[n], &server[i].sid)
+                     != NGX_OK)
+@@ -442,6 +486,9 @@
+         peer[i].max_conns = 0;
          peer[i].max_fails = 1;
          peer[i].fail_timeout = 10;
 +#if (NGX_HTTP_UPSTREAM_CHECK)
@@ -53,8 +89,8 @@
          *peerp = &peer[i];
          peerp = &peer[i].next;
      }
-@@ -339,6 +360,9 @@ ngx_http_upstream_create_round_robin_pee
-         peer[0].current_weight = 0;
+@@ -624,6 +671,9 @@
+         peer[0].max_conns = 0;
          peer[0].max_fails = 1;
          peer[0].fail_timeout = 10;
 +#if (NGX_HTTP_UPSTREAM_CHECK)
@@ -63,8 +99,8 @@
          peers->peer = peer;
  
      } else {
-@@ -381,6 +405,9 @@ ngx_http_upstream_create_round_robin_pee
-             peer[i].current_weight = 0;
+@@ -658,6 +708,9 @@
+             peer[i].max_conns = 0;
              peer[i].max_fails = 1;
              peer[i].fail_timeout = 10;
 +#if (NGX_HTTP_UPSTREAM_CHECK)
@@ -73,20 +109,20 @@
              *peerp = &peer[i];
              peerp = &peer[i].next;
          }
-@@ -441,6 +468,12 @@ ngx_http_upstream_get_round_robin_peer(n
-             goto failed;
-         }
- 
+@@ -733,6 +786,12 @@
+             if (peer->max_conns && peer->conns >= peer->max_conns) {
+                 goto failed;
+             }
++
 +#if (NGX_HTTP_UPSTREAM_CHECK)
-+        if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+            goto failed;
-+        }
++            if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++                goto failed;
++            }
 +#endif
-+
-         rrp->current = peer;
- 
-     } else {
-@@ -542,6 +575,12 @@ ngx_http_upstream_get_peer(ngx_http_upst
+ #if (NGX_HTTP_UPSTREAM_SID)
+         }
+ #endif
+@@ -870,6 +929,12 @@
              continue;
          }
  
@@ -99,3 +135,4 @@
          if (peer->max_fails
              && peer->fails >= peer->max_fails
              && now - peer->checked <= peer->fail_timeout)
+