Made SSI #include file= relative to the current doc, as per spec

This commit is contained in:
Sergey Lyubka committed 2013-07-19 07:57:47 +01:00
1 parent de7745370c
commit e003236a03
7 files changed
+12 -9

No files matched your search

+3 -2
View File
@@ -3611,11 +3611,12 @@ static void do_ssi_include(struct mg_connection *conn, const char *ssi,
// File name is relative to the webserver root
(void) mg_snprintf(conn, path, sizeof(path), "%s%c%s",
conn->ctx->config[DOCUMENT_ROOT], '/', file_name);
} else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1) {
} else if (sscanf(tag, " abspath=\"%[^\"]\"", file_name) == 1) {
// File name is relative to the webserver working directory
// or it is absolute system path
(void) mg_snprintf(conn, path, sizeof(path), "%s", file_name);
} else if (sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
} else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 ||
sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
// File name is relative to the currect document
(void) mg_snprintf(conn, path, sizeof(path), "%s", ssi);
if ((p = strrchr(path, '/')) != NULL) {