From df19ef3d0ae0bdef8ee6a58de16410ecb5e79baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Sat, 17 Oct 2026 08:23:27 -0400 Subject: [PATCH] Fixed the HTTP client build without packet chaining The fragmented-header parsing added for #316 walks packet chains through nx_packet_next and nx_packet_last, which NX_PACKET does not have under NX_DISABLE_PACKET_CHAIN. nx_web_http_client.c stopped compiling in v4_no_chain_build and v6_no_chain_build, and with it the whole netxduo library in those two configurations. The three chain walks are now guarded the way the rest of the file guards them. Without chaining a packet is a single buffer, so the header trim only advances the prepend pointer, and the status-prefix copy and the header cursor stop at the end of the first buffer. With chaining the preprocessed source is byte-identical to before. Both no-chain configurations build again and their full suites pass, and every web configuration's suite passes. No web client test runs without packet chaining in any suite, so the no-chain path is compiled, not exercised. Assisted-by: Claude Code (Opus 5.5) --- addons/web/nx_web_http_client.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/addons/web/nx_web_http_client.c b/addons/web/nx_web_http_client.c index f6507618..0ca038ff 100644 --- a/addons/web/nx_web_http_client.c +++ b/addons/web/nx_web_http_client.c @@ -1322,11 +1322,16 @@ NX_PACKET *tmp_ptr; /* Move the response head to the first body byte and release header packets. */ static NX_PACKET *_nx_web_http_client_response_header_trim(NX_PACKET *packet_ptr, UINT offset) { +#ifndef NX_DISABLE_PACKET_CHAIN NX_PACKET *next_packet_ptr; NX_PACKET *last_packet_ptr = packet_ptr -> nx_packet_last; +#endif /* NX_DISABLE_PACKET_CHAIN */ ULONG remaining_length = packet_ptr -> nx_packet_length - offset; +#ifndef NX_DISABLE_PACKET_CHAIN ULONG fragment_length; +#endif /* NX_DISABLE_PACKET_CHAIN */ +#ifndef NX_DISABLE_PACKET_CHAIN fragment_length = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr); while ((offset >= fragment_length) && (packet_ptr -> nx_packet_next != NX_NULL)) { @@ -1337,10 +1342,13 @@ ULONG fragment_length; packet_ptr = next_packet_ptr; fragment_length = (ULONG)(packet_ptr -> nx_packet_append_ptr - packet_ptr -> nx_packet_prepend_ptr); } +#endif /* NX_DISABLE_PACKET_CHAIN */ packet_ptr -> nx_packet_prepend_ptr += offset; packet_ptr -> nx_packet_length = remaining_length; +#ifndef NX_DISABLE_PACKET_CHAIN packet_ptr -> nx_packet_last = last_packet_ptr; +#endif /* NX_DISABLE_PACKET_CHAIN */ return(packet_ptr); } @@ -1377,7 +1385,11 @@ ULONG copy_length; memcpy(buffer + copied, current_packet_ptr -> nx_packet_prepend_ptr, copy_length); copied += copy_length; } +#ifndef NX_DISABLE_PACKET_CHAIN current_packet_ptr = current_packet_ptr -> nx_packet_next; +#else + current_packet_ptr = NX_NULL; +#endif /* NX_DISABLE_PACKET_CHAIN */ } if (copied != 12U) @@ -5740,7 +5752,11 @@ static UINT _nx_web_http_client_header_byte_get(NX_WEB_HTTP_CLIENT_HEADER_CURSOR while ((cursor -> packet_ptr != NX_NULL) && (cursor -> data_ptr == cursor -> packet_ptr -> nx_packet_append_ptr)) { +#ifndef NX_DISABLE_PACKET_CHAIN cursor -> packet_ptr = cursor -> packet_ptr -> nx_packet_next; +#else + cursor -> packet_ptr = NX_NULL; +#endif /* NX_DISABLE_PACKET_CHAIN */ if (cursor -> packet_ptr != NX_NULL) { cursor -> data_ptr = cursor -> packet_ptr -> nx_packet_prepend_ptr;