@@ -482,12 +482,23 @@ int handle_http1_static_fs_resource(struct http_resource_detail_static_fs *stati
482
482
sizeof("Content-Length: 01234567890123456789\r\n")
483
483
#define CONTENT_ENCODING_HEADER_SIZE \
484
484
sizeof(CONTENT_ENCODING_HEADER) + HTTP_COMPRESSION_MAX_STRING_LEN + sizeof("\r\n")
485
+
486
+ /* Calculate the minimum required size */
485
487
#define STATIC_FS_RESPONSE_SIZE \
486
488
COND_CODE_1( \
487
489
IS_ENABLED(CONFIG_HTTP_SERVER_COMPRESSION), \
488
490
(STATIC_FS_RESPONSE_BASE_SIZE + CONTENT_ENCODING_HEADER_SIZE), \
489
491
(STATIC_FS_RESPONSE_BASE_SIZE))
490
492
493
+ // Issue in Zephyr: https://github.com/zephyrproject-rtos/zephyr/issues/92921
494
+ #if CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE > 0
495
+ BUILD_ASSERT (CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE >= STATIC_FS_RESPONSE_SIZE ,
496
+ "CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE must be at least "
497
+ "large enough to hold HTTP headers" );
498
+ #undef STATIC_FS_RESPONSE_SIZE
499
+ #define STATIC_FS_RESPONSE_SIZE CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE
500
+ #endif
501
+
491
502
enum http_compression chosen_compression = 0 ;
492
503
int len ;
493
504
int remaining ;
@@ -919,7 +930,7 @@ int handle_http1_request(struct http_client_ctx *client)
919
930
920
931
parsed = http_parser_execute (& client -> parser , & client -> parser_settings ,
921
932
client -> cursor , client -> data_len );
922
-
933
+
923
934
if (parsed > client -> data_len ) {
924
935
LOG_ERR ("HTTP/1 parser error, too much data consumed" );
925
936
ret = - EBADMSG ;
0 commit comments