File 0099-nginx-cookie.patch of Package nginx

From 1b44a9ef5f92da08796f019c258ecbebad14e907 Mon Sep 17 00:00:00 2001
From: Ganapathi Chidambaram <ganapathi.rj@gmail.com>
Date: Sat, 16 Dec 2023 23:12:29 +0530
Subject: [PATCH 1/1] fix():nginx 1.23 build error fix

---
 ngx_http_sticky_misc.c   | 4 ++--
 ngx_http_sticky_module.c | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/nginx-sticky-module-ng/ngx_http_sticky_misc.c b/nginx-sticky-module-ng/ngx_http_sticky_misc.c
index d1ee110..c6ab329 100644
--- a/nginx-sticky-module-ng/ngx_http_sticky_misc.c
+++ b/nginx-sticky-module-ng/ngx_http_sticky_misc.c
@@ -20,8 +20,8 @@
 #define MD5_CBLOCK  64
 #define MD5_LBLOCK  (MD5_CBLOCK/4)
 #define MD5_DIGEST_LENGTH 16
-#define SHA_CBLOCK 64
-#define SHA_DIGEST_LENGTH 20
+//#define SHA_CBLOCK 64
+//#define SHA_DIGEST_LENGTH 20

 #ifndef SHA_DIGEST_LENGTH
 #define SHA_CBLOCK 64
diff --git a/nginx-sticky-module-ng/ngx_http_sticky_module.c b/nginx-sticky-module-ng/ngx_http_sticky_module.c
index 3b94741..37e687a 100644
--- a/nginx-sticky-module-ng/ngx_http_sticky_module.c
+++ b/nginx-sticky-module-ng/ngx_http_sticky_module.c
@@ -240,7 +240,11 @@ static ngx_int_t ngx_http_init_sticky_peer(ngx_http_request_t *r, ngx_http_upstr
 	ngx_http_set_ctx(r, iphp, ngx_http_sticky_module);

 	/* check weather a cookie is present or not and save it */
+#if defined(nginx_version) && nginx_version >= 1023000
+	if (ngx_http_parse_multi_header_lines(r, r->headers_in.cookie, &iphp->sticky_conf->cookie_name, &route) != NULL) {
+#else
 	if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &iphp->sticky_conf->cookie_name, &route) != NGX_DECLINED) {
+#endif
 		/* a route cookie has been found. Let's give it a try */
 		ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "[sticky/init_sticky_peer] got cookie route=%V, let's try to find a matching peer", &route);

@@ -472,7 +476,11 @@ static ngx_int_t ngx_http_sticky_header_filter(ngx_http_request_t *r)
 	}

 	if (ctx->sticky_conf->transfer_cookie) {
+#if defined(nginx_version) && nginx_version >= 1023000
+		if (ngx_http_parse_set_cookie_lines(r, r->upstream->headers_in.set_cookie, &ctx->sticky_conf->cookie_name, &transfer_cookie) == NULL)
+#else
 		if (ngx_http_parse_set_cookie_lines(&r->upstream->headers_in.cookies, &ctx->sticky_conf->cookie_name, &transfer_cookie) == NGX_DECLINED)
+#endif
 		{
 			ngx_str_null(&transfer_cookie);
 		}
--
2.39.3 (Apple Git-145)

openSUSE Build Service is sponsored by