httpd: SSI types should be overridable (task #15071)

Add define LWIP_HTTPD_SSI_EXTENSIONS to make the extension list
overridable, clarify documentation of LWIP_HTTPD_SSI_BY_FILE_EXTENSION
a bit.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2018-10-23 08:17:45 +02:00
parent f6b728b24c
commit ff8d1a384f
2 changed files with 14 additions and 4 deletions

View File

@ -113,11 +113,11 @@ static const tHTTPHeader g_psHTTPHeaders[] = {
#endif /* LWIP_HTTPD_DYNAMIC_HEADERS */
#if LWIP_HTTPD_SSI
#if LWIP_HTTPD_SSI && LWIP_HTTPD_SSI_BY_FILE_EXTENSION
static const char *const g_pcSSIExtensions[] = {
".shtml", ".shtm", ".ssi", ".xml", ".json"
LWIP_HTTPD_SSI_EXTENSIONS
};
#define NUM_SHTML_EXTENSIONS LWIP_ARRAYSIZE(g_pcSSIExtensions)
#endif /* LWIP_HTTPD_SSI */
#endif /* LWIP_HTTPD_SSI && LWIP_HTTPD_SSI_BY_FILE_EXTENSION */
#endif /* LWIP_HTTPD_STRUCTS_H */

View File

@ -112,7 +112,9 @@
/** Set this to 0 to prevent parsing the file extension at runtime to decide
* if a file should be scanned for SSI tags or not.
* Default is 1 (file extensions are checked using the g_pcSSIExtensions array)
* Set to 2 to override this runtime test function.
* Set to 2 to override this runtime test function. In this case, you have to
* provide an external function that does the check:
* u8_t http_uri_is_ssi(struct fs_file *file, const char *uri)
*
* This is enabled by default, but if you only use a newer version of makefsdata
* supporting the "-ssi" option, this info is already present in
@ -121,6 +123,14 @@
#define LWIP_HTTPD_SSI_BY_FILE_EXTENSION 1
#endif
/** This is a list of file extensions handled as SSI files. This define
* is used to initialize a 'const char *const[]'. It is only used if
* LWIP_HTTPD_SSI_BY_FILE_EXTENSION != 0.
*/
#if !defined LWIP_HTTPD_SSI_EXTENSIONS || defined __DOXYGEN__
#define LWIP_HTTPD_SSI_EXTENSIONS ".shtml", ".shtm", ".ssi", ".xml", ".json"
#endif
/** Set this to 1 to support HTTP POST */
#if !defined LWIP_HTTPD_SUPPORT_POST || defined __DOXYGEN__
#define LWIP_HTTPD_SUPPORT_POST 0