Add SSI include file=, include virtual=

This commit is contained in:
cpq
2021-01-02 17:57:51 +00:00
parent 86824795a0
commit c7e09bd7b4
24 changed files with 289 additions and 29 deletions
+1
View File
@@ -0,0 +1 @@
this is f1
+3
View File
@@ -0,0 +1,3 @@
this is index
<!--#include file="nested.shtml" -->
<!--#include file="recurse.shtml" -->
+3
View File
@@ -0,0 +1,3 @@
this is nested
<!--#include virtual="/notexist.txt"-->
<!--#include virtual="/ssi/f1.txt"-->
+2
View File
@@ -0,0 +1,2 @@
<!--#include file="recurse.shtml"-->
recurse
+12 -1
View File
@@ -349,7 +349,7 @@ static void eh1(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
struct mg_http_serve_opts opts = {".", NULL};
mg_http_serve_dir(c, hm, &opts);
} else {
struct mg_http_serve_opts opts = {"./test/data", NULL};
struct mg_http_serve_opts opts = {"./test/data", "#.shtml"};
mg_http_serve_dir(c, hm, &opts);
}
} else if (ev == MG_EV_WS_MSG) {
@@ -477,6 +477,17 @@ static void test_http_server(void) {
"Content-Length: 4\r\n\r\nkuku") == 200);
ASSERT(cmpbody(buf, "kuku") == 0);
ASSERT(fetch(&mgr, buf, url, "GET /ssi HTTP/1.1\r\n\r\n") == 200);
ASSERT(cmpbody(buf,
"this is index\n"
"this is nested\n\n"
"this is f1\n\n\n\n"
"recurse\n\n"
"recurse\n\n"
"recurse\n\n"
"recurse\n\n"
"recurse\n\n") == 0);
ASSERT(fetch(&mgr, buf, url, "GET /badroot HTTP/1.0\r\n\n") == 400);
#if MG_ARCH == MG_ARCH_WIN32
ASSERT(cmpbody(buf, "Bad web root [Z:\\BAAADDD!]\n") == 0);