Skip to content

Conversation

@abhinavkumar1203
Copy link

This pull request upgrades lib-nginx to use Nginx 1.28.0, ensuring compatibility with the latest upstream release. The upgrade includes:

Updated the source tarball to version 1.28.0

Replaced missing Huffman encode/decode functions with minimal stubs to retain build compatibility

Retained important legacy patches and dropped disabled ones

Notes -
The ngx_http_huff_encode and ngx_http_huff_decode functions were removed upstream. Stub implementations are provided to avoid breaking dependencies in the Unikraft integration.

Verified that the application builds and runs with the new Nginx version

Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from my side. Please make sure this builds and runs also.

Comment on lines +1 to +51
diff --git a/Config.uk b/Config.uk
index 3b907e8..2719b5d 100644
--- a/Config.uk
+++ b/Config.uk
@@ -1,6 +1,6 @@
menuconfig LIBNGINX
bool "libnginx - a HTTP and reverse proxy, a mail proxy, and a generic TCP/UDP proxy server"
- default n
+ default y
select LIBUKSCHEDCOOP
select LIBPOSIX_LIBDL
select LIBPOSIX_PROCESS
diff --git a/Library.uk b/Library.uk
index fc1f309..c3a9d5d 100644
--- a/Library.uk
+++ b/Library.uk
@@ -1,5 +1,5 @@
name := "nginx"
description := "A HTTP and reverse proxy, a mail proxy, and a generic TCP/UDP proxy server."
homepage := "https://nginx.org/"
-version := 1.15.6 sha256:a3d8c67c2035808c7c0d475fffe263db8c353b11521aa7ade468b780ed826cc6 http://nginx.org/download/nginx-1.15.6.tar.gz
+version := 1.28.0 c6b5c6b086c0df9d3ca3ff5e084c1d0ef909e6038279c71c1c3e985f576ff76a http://nginx.org/download/nginx-1.28.0.tar.gz
license := "BSD-2-Clause"
diff --git a/Makefile.uk b/Makefile.uk
index 29db863..dfe367a 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -42,7 +42,7 @@ $(eval $(call addlib_s,libnginx,$(CONFIG_LIBNGINX)))
################################################################################
# Sources
################################################################################
-LIBNGINX_VERSION = 1.15.6
+LIBNGINX_VERSION = 1.28.0
LIBNGINX_BASENAME = nginx-$(LIBNGINX_VERSION)
LIBNGINX_URL = http://nginx.org/download/$(LIBNGINX_BASENAME).tar.gz
LIBNGINX_PATCHDIR = $(LIBNGINX_BASE)/patches
@@ -180,8 +180,10 @@ LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP) += $(LIBNGINX_SRC)/http/modules/ngx_http_l
LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP) += $(LIBNGINX_SRC)/http/ngx_http_header_filter_module.c
LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP) += $(LIBNGINX_SRC)/http/modules/ngx_http_chunked_filter_module.c
LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_encode.c
-# Huffman encode/decode not supported
-LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_huff_decode.c
-LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_huff_encode.c
+# LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_huff_decode.c
+# LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_huff_encode.c
LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_table.c
LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2.c
LIBNGINX_SRCS-$(CONFIG_LIBNGINX_HTTP_V2) += $(LIBNGINX_SRC)/http/v2/ngx_http_v2_filter_module.c
+
+# Stub replacements for huffman functions
+LIBNGINX_SRCS-y += $(LIBNGINX_BASE)/src/nginx_huff_stubs.cx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file doesn't really make sense. You created a patch for things already in the repository. Why not just change those?, why do a patch? How would this even apply.

Comment on lines +1 to +27
From 30557083a93221ea1e5817c60bad16d4bd13a16c Mon Sep 17 00:00:00 2001
From: Mihai Pogonaru <[email protected]>
Date: Fri, 14 Jun 2019 01:31:43 +0300
Subject: [PATCH] pthread-embedded does not allow semaphores shared between
processes

Signed-off-by: Mihai Pogonaru <[email protected]>
---
src/core/ngx_shmtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/ngx_shmtx.c b/src/core/ngx_shmtx.c
index a255903..6da5cab 100644
--- a/src/core/ngx_shmtx.c
+++ b/src/core/ngx_shmtx.c
@@ -30,7 +30,7 @@ ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr, u_char *name)

mtx->wait = &addr->wait;

- if (sem_init(&mtx->sem, 1, 0) == -1) {
+ if (sem_init(&mtx->sem, 0, 0) == -1) {
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno,
"sem_init() failed");
} else {
--
2.11.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just delete this if it is not needed anymore?

Comment on lines +1 to +28
From 0c3c7ca3fec1f1e2b4d6c3b2739ece484ce4cb92 Mon Sep 17 00:00:00 2001
From: Razvan Virtan <[email protected]>
Date: Tue, 20 Jul 2021 19:52:48 +0300
Subject: [PATCH] Initialize nginx cached time structures

---
src/core/ngx_times.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index 7964b00..ffb317f 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -73,6 +73,12 @@ ngx_time_init(void)

ngx_cached_time = &cached_time[0];

+ ngx_cached_http_time.data = &cached_http_time[0][0];
+ ngx_cached_err_log_time.data = &cached_err_log_time[0][0];
+ ngx_cached_http_log_time.data = &cached_http_log_time[0][0];
+ ngx_cached_http_log_iso8601.data = &cached_http_log_iso8601[0][0];
+ ngx_cached_syslog_time.data = &cached_syslog_time[0][0];
+
ngx_time_update();
}

--
2.17.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this

Comment on lines +1 to +38
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -19,6 +19,9 @@
#include <ngx_http_v2_module.h>
#include <ngx_http_request.h>

+// Forward declaration of stub
+extern ngx_int_t ngx_http_huff_decode_stub(u_char *, u_char *, size_t, u_char, ngx_uint_t, ngx_log_t *);
+
static ngx_http_v2_handler_pt ngx_http_v2_state[] = {
ngx_http_v2_state_head,
ngx_http_v2_state_head,
@@ -1583,7 +1586,7 @@ ngx_http_v2_state_field_huff(ngx_http_v2_connection_t *h2c,
u_char ch;
ngx_uint_t state = 0;

- rc = ngx_http_huff_decode(&state, pos, len, ch, lower, h2c->connection->log);
+ rc = ngx_http_huff_decode_stub(&state, pos, len, ch, lower, h2c->connection->log);

if (rc != NGX_OK) {
return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_COMP_ERROR);
--- a/src/http/modules/ngx_http_grpc_module.c
+++ b/src/http/modules/ngx_http_grpc_module.c
@@ -10,6 +10,9 @@
#include <ngx_http.h>
#include <ngx_http_grpc_module.h>

+// Forward declaration of stub
+extern ngx_int_t ngx_http_huff_decode_stub(u_char *, u_char *, size_t, u_char, ngx_uint_t, ngx_log_t *);
+
@@ -3201,7 +3204,7 @@ ngx_http_grpc_parse_fragment(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx, ngx_buf_t *b)
// original call
- rc = ngx_http_huff_decode(&ctx->state, p, end - p, ch, 0, r->connection->log);
+ rc = ngx_http_huff_decode_stub(&ctx->state, p, end - p, ch, 0, r->connection->log);
@@ -3310,7 +3313,7 @@ ngx_http_grpc_parse_fragment(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx, ngx_buf_t *b)
// original call
- rc = ngx_http_huff_decode(&ctx->state, p, end - p, ch, 0, r->connection->log);
+ rc = ngx_http_huff_decode_stub(&ctx->state, p, end - p, ch, 0, r->connection->log);
Copy link
Member

@craciunoiuc craciunoiuc Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work. You are declaring the stub to use instead, but you never defined them. Did you forget to commit a file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants