From 69725292a0702abfb15959f1e24cbd1f16878642 Mon Sep 17 00:00:00 2001 From: Mike Kleshov Date: Thu, 28 Jan 2021 08:29:25 +0300 Subject: [PATCH] httpd: wrap fs_file::pextension in a config macro see bug #59876 --- src/include/lwip/apps/fs.h | 2 ++ src/include/lwip/apps/httpd_opts.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/include/lwip/apps/fs.h b/src/include/lwip/apps/fs.h index 2241e886..5aa7d18f 100644 --- a/src/include/lwip/apps/fs.h +++ b/src/include/lwip/apps/fs.h @@ -67,9 +67,11 @@ struct fs_file { const char *data; int len; int index; +#if LWIP_HTTPD_FILE_EXTENSION /* pextension is free for implementations to hold private (extensional) arbitrary data, e.g. holding some file state or file system handle */ fs_file_extension *pextension; +#endif /* LWIP_HTTPD_FILE_EXTENSION */ #if HTTPD_PRECALCULATED_CHECKSUM const struct fsdata_chksum *chksum; u16_t chksum_count; diff --git a/src/include/lwip/apps/httpd_opts.h b/src/include/lwip/apps/httpd_opts.h index 4fae46fe..2b66e671 100644 --- a/src/include/lwip/apps/httpd_opts.h +++ b/src/include/lwip/apps/httpd_opts.h @@ -375,6 +375,16 @@ #define LWIP_HTTPD_FILE_STATE 0 #endif +/** Set this to 1 to add the pextension field to the fs_file structure. + * This is included here to retain compatibility with legacy code that + * relies on the presence of the pextension field. + * New code should use LWIP_HTTPD_FILE_STATE instead. + * This option may be removed in a future version of lwip. + */ +#if !defined LWIP_HTTPD_FILE_EXTENSION || defined __DOXYGEN__ +#define LWIP_HTTPD_FILE_EXTENSION 0 +#endif + /** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for * predefined (MSS-sized) chunks of the files to prevent having to calculate * the checksums at runtime. */