mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-29 12:41:03 +00:00
Options ssi_extensions, cgi_extensions became cgi_pattern, ssi_pattern
This commit is contained in:
1 parent
01c5ee0973
commit
ed70793670
4 files changed
+115
-109
No files matched your search
+19
-1
@@ -150,6 +150,11 @@ if (scalar(@ARGV) > 0 and $ARGV[0] eq 'embedded') {
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (scalar(@ARGV) > 0 and $ARGV[0] eq 'unit') {
|
||||
do_unit_test();
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Make sure we load config file if no options are given.
|
||||
# Command line options override config files settings
|
||||
write_file($config, "access_log_file access.log\nlistening_ports 12345\n");
|
||||
@@ -166,7 +171,7 @@ my $cmd = "$exe $config -listening_ports $port -access_log_file access.log ".
|
||||
"-extra_mime_types .bar=foo/bar,.tar.gz=blah,.baz=foo " .
|
||||
'-put_delete_passwords_file test/passfile ' .
|
||||
'-access_control_list -0.0.0.0/0,+127.0.0.1 ' .
|
||||
"-document_root $root,/aiased=/etc/,/ta=$test_dir";
|
||||
"-document_root $root -url_rewrite_patterns /aiased=/etc/,/ta=$test_dir";
|
||||
$cmd .= ' -cgi_interpreter perl' if on_windows();
|
||||
spawn($cmd);
|
||||
|
||||
@@ -386,6 +391,7 @@ unless (scalar(@ARGV) > 0 and $ARGV[0] eq "basic_tests") {
|
||||
|
||||
do_PUT_test();
|
||||
kill_spawned_child();
|
||||
do_unit_test();
|
||||
do_embedded_test();
|
||||
}
|
||||
|
||||
@@ -415,6 +421,18 @@ sub do_PUT_test {
|
||||
"HTTP/1.1 100 Continue.+HTTP/1.1 200", 'PUT 100-Continue');
|
||||
}
|
||||
|
||||
sub do_unit_test {
|
||||
my $cmd = "cc -W -Wall -o $unit_test_exe $root/unit_test.c -I. ".
|
||||
"-pthread -DNO_SSL ";
|
||||
if (on_windows()) {
|
||||
$cmd = "cl $root/embed.c mongoose.c /I. /nologo /DNO_SSL ".
|
||||
"/DLISTENING_PORT=\\\"$port\\\" /link /out:$embed_exe.exe ws2_32.lib ";
|
||||
}
|
||||
print $cmd, "\n";
|
||||
system($cmd) == 0 or fail("Cannot compile unit test");
|
||||
system($unit_test_exe) == 0 or fail("Unit test failed!");
|
||||
}
|
||||
|
||||
sub do_embedded_test {
|
||||
my $cmd = "cc -W -Wall -o $embed_exe $root/embed.c mongoose.c -I. ".
|
||||
"-pthread -DNO_SSL -DLISTENING_PORT=\\\"$port\\\"";
|
||||
|
||||
@@ -8,6 +8,12 @@ int main(void) {
|
||||
assert(match_prefix("/*", 2, "/a/b/c") == 2);
|
||||
assert(match_prefix("*/*", 3, "/a/b/c") == 2);
|
||||
assert(match_prefix("**/", 3, "/a/b/c") == 5);
|
||||
assert(match_prefix("**.foo|**.bar", 13, "a.bar") == 5);
|
||||
assert(match_prefix("a|b|cd", 6, "cdef") == 2);
|
||||
assert(match_prefix("a|b|c?", 6, "cdef") == 2);
|
||||
assert(match_prefix("a|?|cd", 6, "cdef") == 1);
|
||||
assert(match_prefix("/a/**.cgi", 9, "/foo/bar/x.cgi") == 0);
|
||||
assert(match_prefix("/a/**.cgi", 9, "/a/bar/x.cgi") == 12);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user