From da01bc4d158a18eb6b43fac9d796f40e1ae56e84 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 16 Nov 2017 22:29:44 +0100 Subject: [PATCH] httpd: ssi: support selecting ssi files by file flags, not by extension (at runtime) only --- src/apps/httpd/httpd.c | 12 ++++++++++-- src/include/lwip/apps/fs.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/apps/httpd/httpd.c b/src/apps/httpd/httpd.c index b3ca15b4..1bd06100 100644 --- a/src/apps/httpd/httpd.c +++ b/src/apps/httpd/httpd.c @@ -2234,8 +2234,16 @@ http_find_file(struct http_state *hs, const char *uri, int is_09) } else { file = http_get_404_file(hs, &uri); } -#if LWIP_HTTPD_SSI && LWIP_HTTPD_SSI_BY_FILE_EXTENSION - tag_check = http_uri_is_ssi(file, uri); +#if LWIP_HTTPD_SSI + if (file != NULL) { + if (file->flags & FS_FILE_FLAGS_SSI) { + tag_check = 1; + } else { +#if LWIP_HTTPD_SSI_BY_FILE_EXTENSION + tag_check = http_uri_is_ssi(file, uri); +#endif /* LWIP_HTTPD_SSI_BY_FILE_EXTENSION */ + } + } #endif /* LWIP_HTTPD_SSI */ } if (file == NULL) { diff --git a/src/include/lwip/apps/fs.h b/src/include/lwip/apps/fs.h index 0a2d13a0..1c119fe7 100644 --- a/src/include/lwip/apps/fs.h +++ b/src/include/lwip/apps/fs.h @@ -52,6 +52,8 @@ struct fsdata_chksum { #define FS_FILE_FLAGS_HEADER_INCLUDED 0x01 #define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02 +#define FS_FILE_FLAGS_HEADER_KEEPALIVE 0x04 +#define FS_FILE_FLAGS_SSI 0x08 /** Define FS_FILE_EXTENSION_T_DEFINED if you have typedef'ed to your private * pointer type (defaults to 'void' so the default usage is 'void*')