File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,16 @@ config HTTP_SERVER_COMPRESSION
219
219
5. deflate -> .zz
220
220
6. File without compression
221
221
222
+ config HTTP_SERVER_STATIC_FS_RESPONSE_SIZE
223
+ int "Size of static file system response buffer"
224
+ depends on FILE_SYSTEM
225
+ default 1024
226
+ help
227
+ The size of a single chunk when serving static files from the file system.
228
+ Please note that it is allocated on the stack of the HTTP server thread,
229
+ so CONFIG_HTTP_SERVER_STACK_SIZE has to be sufficiently large.
230
+ This config value must also be large enough to hold the headers in a single chunk.
231
+
222
232
endif
223
233
224
234
# Hidden option to avoid having multiple individual options that are ORed together
Original file line number Diff line number Diff line change @@ -482,11 +482,19 @@ 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
+ /* Calculate the minimum size required for the headers */
485
486
#define STATIC_FS_RESPONSE_SIZE \
486
487
COND_CODE_1( \
487
488
IS_ENABLED(CONFIG_HTTP_SERVER_COMPRESSION), \
488
489
(STATIC_FS_RESPONSE_BASE_SIZE + CONTENT_ENCODING_HEADER_SIZE), \
489
490
(STATIC_FS_RESPONSE_BASE_SIZE))
491
+ #ifdef CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE
492
+ BUILD_ASSERT (CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE >= STATIC_FS_RESPONSE_SIZE ,
493
+ "CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE must be at least "
494
+ "large enough to hold HTTP headers" );
495
+ #undef STATIC_FS_RESPONSE_SIZE
496
+ #define STATIC_FS_RESPONSE_SIZE CONFIG_HTTP_SERVER_STATIC_FS_RESPONSE_SIZE
497
+ #endif
490
498
491
499
enum http_compression chosen_compression = 0 ;
492
500
int len ;
You can’t perform that action at this time.
0 commit comments