Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
e003236a
Commit
e003236a
authored
Jul 19, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made SSI #include file= relative to the current doc, as per spec
parent
de774537
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
9 deletions
+12
-9
UserManual.md
UserManual.md
+4
-2
mongoose.c
mongoose.c
+3
-2
ssi1.shtml
test/ssi1.shtml
+1
-1
ssi5.shtml
test/ssi5.shtml
+1
-1
ssi6.shtml
test/ssi6.shtml
+1
-1
ssi9.shtml
test/ssi9.shtml
+1
-1
test.pl
test/test.pl
+1
-1
No files found.
UserManual.md
View file @
e003236a
...
@@ -143,8 +143,10 @@ directives are supported, `<!--#include ...>` and
...
@@ -143,8 +143,10 @@ directives are supported, `<!--#include ...>` and
three path specifications:
three path specifications:
<!--#include virtual="path"> Path is relative to web server root
<!--#include virtual="path"> Path is relative to web server root
<!--#include file="path"> Path is relative to web server working dir
<!--#include abspath="path"> Path is absolute or relative to
<!--#include "path"> Path is relative to current document
web server working dir
<!--#include file="path">, Path is relative to current document
<!--#include "path">
The
`include`
directive may be used to include the contents of a file or the
The
`include`
directive may be used to include the contents of a file or the
result of running a CGI script. The
`exec`
directive is used to execute a
result of running a CGI script. The
`exec`
directive is used to execute a
...
...
mongoose.c
View file @
e003236a
...
@@ -3611,11 +3611,12 @@ static void do_ssi_include(struct mg_connection *conn, const char *ssi,
...
@@ -3611,11 +3611,12 @@ static void do_ssi_include(struct mg_connection *conn, const char *ssi,
// File name is relative to the webserver root
// File name is relative to the webserver root
(
void
)
mg_snprintf
(
conn
,
path
,
sizeof
(
path
),
"%s%c%s"
,
(
void
)
mg_snprintf
(
conn
,
path
,
sizeof
(
path
),
"%s%c%s"
,
conn
->
ctx
->
config
[
DOCUMENT_ROOT
],
'/'
,
file_name
);
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
// File name is relative to the webserver working directory
// or it is absolute system path
// or it is absolute system path
(
void
)
mg_snprintf
(
conn
,
path
,
sizeof
(
path
),
"%s"
,
file_name
);
(
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
// File name is relative to the currect document
(
void
)
mg_snprintf
(
conn
,
path
,
sizeof
(
path
),
"%s"
,
ssi
);
(
void
)
mg_snprintf
(
conn
,
path
,
sizeof
(
path
),
"%s"
,
ssi
);
if
((
p
=
strrchr
(
path
,
'/'
))
!=
NULL
)
{
if
((
p
=
strrchr
(
path
,
'/'
))
!=
NULL
)
{
...
...
test/ssi1.shtml
View file @
e003236a
<html><pre>
<html><pre>
ssi_begin
ssi_begin
<!--#include file="Makefile" -->
<!--#include file="
../
Makefile" -->
ssi_end
ssi_end
</pre></html>
</pre></html>
test/ssi5.shtml
View file @
e003236a
<html><pre>
<html><pre>
ssi_begin
ssi_begin
<!--#include
file
="/etc/passwd" -->
<!--#include
abspath
="/etc/passwd" -->
ssi_end
ssi_end
</pre></html>
</pre></html>
test/ssi6.shtml
View file @
e003236a
<html><pre>
<html><pre>
ssi_begin
ssi_begin
<!--#include
file
="c:\boot.ini" -->
<!--#include
abspath
="c:\boot.ini" -->
ssi_end
ssi_end
</pre></html>
</pre></html>
test/ssi9.shtml
View file @
e003236a
ssi_begin
ssi_begin
<!--#include file="Makefile" -->
<!--#include file="
../
Makefile" -->
ssi_end
ssi_end
test/test.pl
View file @
e003236a
...
@@ -403,7 +403,7 @@ unless (scalar(@ARGV) > 0 and $ARGV[0] eq "basic_tests") {
...
@@ -403,7 +403,7 @@ unless (scalar(@ARGV) > 0 and $ARGV[0] eq "basic_tests") {
my
$abs_path
=
on_windows
()
?
'ssi6.shtml'
:
'ssi5.shtml'
;
my
$abs_path
=
on_windows
()
?
'ssi6.shtml'
:
'ssi5.shtml'
;
my
$word
=
on_windows
()
?
'boot loader'
:
'root'
;
my
$word
=
on_windows
()
?
'boot loader'
:
'root'
;
o
(
"GET /$abs_path HTTP/1.0\n\n"
,
o
(
"GET /$abs_path HTTP/1.0\n\n"
,
"ssi_begin.+$word.+ssi_end"
,
'SSI #include
file= (absolute)
'
);
"ssi_begin.+$word.+ssi_end"
,
'SSI #include
abspath
'
);
o
(
"GET /ssi7.shtml HTTP/1.0\n\n"
,
o
(
"GET /ssi7.shtml HTTP/1.0\n\n"
,
'ssi_begin.+Unit test.+ssi_end'
,
'SSI #include "..."'
);
'ssi_begin.+Unit test.+ssi_end'
,
'SSI #include "..."'
);
o
(
"GET /ssi8.shtml HTTP/1.0\n\n"
,
o
(
"GET /ssi8.shtml HTTP/1.0\n\n"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment