diff --git a/backport-Fix-sizeof-http_parser-assert.patch b/backport-Fix-sizeof-http_parser-assert.patch new file mode 100644 index 0000000000000000000000000000000000000000..d5fa0ad00a383cd24865dfb9602b94aaab2546b4 --- /dev/null +++ b/backport-Fix-sizeof-http_parser-assert.patch @@ -0,0 +1,40 @@ +From 4f15b7d510dc7c6361a26a7c6d2f7c3a17f8d878 Mon Sep 17 00:00:00 2001 +From: Ben Noordhuis +Date: Fri, 10 Jul 2020 11:55:11 +0200 +Subject: [PATCH] Fix sizeof(http_parser) assert + +The result should be 32 on both 32 bits and 64 bits x86 because of +struct padding. + +Fixes: https://github.com/nodejs/http-parser/issues/507 +PR-URL: https://github.com/nodejs/http-parser/pull/510 +Reviewed-By: Fedor Indutny + +Conflict:NA +Reference:https://github.com/nodejs/http-parser/commit/4f15b7d510dc7c6361a26a7c6d2f7c3a17f8d878 +--- + test.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/test.c b/test.c +index 53a3163..3f7c77b 100644 +--- a/test.c ++++ b/test.c +@@ -4343,7 +4343,13 @@ main (void) + printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version); + + printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser)); +- assert(sizeof(http_parser) == 4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *)); ++ ++#if defined(__i386__) || defined(__x86_64__) ++ /* Should be 32 on both 32 bits and 64 bits x86 because of struct padding, ++ * see https://github.com/nodejs/http-parser/issues/507. ++ */ ++ assert(sizeof(http_parser) == 32); ++#endif + + //// API + test_preserve_data(); +-- +2.33.0 + diff --git a/http-parser.spec b/http-parser.spec index f95f48b0d9e744dd8098108be8d8b269caf737dc..b4448d08947cf4ad24643edf2b81f178df5ad4bd 100644 --- a/http-parser.spec +++ b/http-parser.spec @@ -1,6 +1,6 @@ Name: http-parser Version: 2.9.4 -Release: 2 +Release: 3 Summary: HTTP request/response parser for C License: MIT @@ -8,6 +8,7 @@ URL: https://github.com/nodejs/%{name} Source0: https://github.com/nodejs/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Patch6000: backport-url-treat-empty-port-as-default.patch +Patch6001: backport-Fix-sizeof-http_parser-assert.patch BuildRequires: gcc meson @@ -84,6 +85,9 @@ EOF %doc AUTHORS README.md %changelog +* Fri Aug 02 2024 zhouyihang - 2.9.4-3 +- Fix sizeof(http_parser) assert + * Mon Jul 25 2022 yanglu - 2.9.4-2 - Include patch to work colon but no port