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
62d66201
Commit
62d66201
authored
Jul 25, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make match_prefix() case-insensitive
parent
f32e1447
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
mongoose.c
mongoose.c
+2
-1
test.pl
test/test.pl
+1
-1
unit_test.c
test/unit_test.c
+2
-1
No files found.
mongoose.c
View file @
62d66201
...
@@ -874,6 +874,7 @@ static const char *next_option(const char *list, struct vec *val,
...
@@ -874,6 +874,7 @@ static const char *next_option(const char *list, struct vec *val,
return
list
;
return
list
;
}
}
// Perform case-insensitive match of string against pattern
static
int
match_prefix
(
const
char
*
pattern
,
int
pattern_len
,
const
char
*
str
)
{
static
int
match_prefix
(
const
char
*
pattern
,
int
pattern_len
,
const
char
*
str
)
{
const
char
*
or_str
;
const
char
*
or_str
;
int
i
,
j
,
len
,
res
;
int
i
,
j
,
len
,
res
;
...
@@ -906,7 +907,7 @@ static int match_prefix(const char *pattern, int pattern_len, const char *str) {
...
@@ -906,7 +907,7 @@ static int match_prefix(const char *pattern, int pattern_len, const char *str) {
res
=
match_prefix
(
pattern
+
i
,
pattern_len
-
i
,
str
+
j
+
len
);
res
=
match_prefix
(
pattern
+
i
,
pattern_len
-
i
,
str
+
j
+
len
);
}
while
(
res
==
-
1
&&
len
--
>
0
);
}
while
(
res
==
-
1
&&
len
--
>
0
);
return
res
==
-
1
?
-
1
:
j
+
res
+
len
;
return
res
==
-
1
?
-
1
:
j
+
res
+
len
;
}
else
if
(
pattern
[
i
]
!=
str
[
j
]
)
{
}
else
if
(
lowercase
(
&
pattern
[
i
])
!=
lowercase
(
&
str
[
j
])
)
{
return
-
1
;
return
-
1
;
}
}
}
}
...
...
test/test.pl
View file @
62d66201
...
@@ -171,7 +171,7 @@ my $cmd = "$mongoose_exe ".
...
@@ -171,7 +171,7 @@ my $cmd = "$mongoose_exe ".
'-put_delete_auth_file test/passfile '
.
'-put_delete_auth_file test/passfile '
.
'-access_control_list -0.0.0.0/0,+127.0.0.1 '
.
'-access_control_list -0.0.0.0/0,+127.0.0.1 '
.
"-document_root $root "
.
"-document_root $root "
.
"-hide_files_patterns **exploit.
pl
"
.
"-hide_files_patterns **exploit.
PL
"
.
"-enable_keep_alive yes "
.
"-enable_keep_alive yes "
.
"-url_rewrite_patterns /aiased=/etc/,/ta=$test_dir"
;
"-url_rewrite_patterns /aiased=/etc/,/ta=$test_dir"
;
$cmd
.=
' -cgi_interpreter perl'
if
on_windows
();
$cmd
.=
' -cgi_interpreter perl'
if
on_windows
();
...
...
test/unit_test.c
View file @
62d66201
...
@@ -154,7 +154,8 @@ static void test_match_prefix(void) {
...
@@ -154,7 +154,8 @@ static void test_match_prefix(void) {
ASSERT
(
match_prefix
(
"*"
,
1
,
"/hello/"
)
==
0
);
ASSERT
(
match_prefix
(
"*"
,
1
,
"/hello/"
)
==
0
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b/"
)
==
-
1
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b/"
)
==
-
1
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b"
)
==
6
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b"
)
==
6
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.a"
)
==
6
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/B.A"
)
==
6
);
ASSERT
(
match_prefix
(
"**o$"
,
4
,
"HELLO"
)
==
5
);
}
}
static
void
test_remove_double_dots
()
{
static
void
test_remove_double_dots
()
{
...
...
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