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
bf7a115b
Commit
bf7a115b
authored
May 11, 2015
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix url rewrites
parent
b8dfb69c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletion
+5
-1
web_server.c
examples/web_server/web_server.c
+2
-0
mongoose.c
mongoose.c
+2
-1
unit_test.c
test/unit_test.c
+1
-0
No files found.
examples/web_server/web_server.c
View file @
bf7a115b
...
...
@@ -40,7 +40,9 @@
#define DIRSEP '\\'
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#ifndef sleep
#define sleep(x) Sleep((x) * 1000)
#endif
#define abs_path(rel, abs, abs_size) _fullpath((abs), (rel), (abs_size))
#define SIGCHLD 0
typedef
struct
_stat
file_stat_t
;
...
...
mongoose.c
View file @
bf7a115b
...
...
@@ -2681,7 +2681,8 @@ static int convert_uri_to_file_name(struct connection *conn, char *buf,
#endif
const
char
*
uri
=
conn
->
mg_conn
.
uri
;
const
char
*
domain
=
mg_get_header
(
&
conn
->
mg_conn
,
"Host"
);
size_t
match_len
,
root_len
=
root
==
NULL
?
0
:
strlen
(
root
);
// Important: match_len has to be declared as int, unless rewrites break.
int
match_len
,
root_len
=
root
==
NULL
?
0
:
strlen
(
root
);
// Perform virtual hosting rewrites
if
(
rewrites
!=
NULL
&&
domain
!=
NULL
)
{
...
...
test/unit_test.c
View file @
bf7a115b
...
...
@@ -169,6 +169,7 @@ static const char *test_match_prefix(void) {
ASSERT
(
mg_match_prefix
(
"/api"
,
4
,
"/api"
)
==
4
);
ASSERT
(
mg_match_prefix
(
"/a/"
,
3
,
"/a/b/c"
)
==
3
);
ASSERT
(
mg_match_prefix
(
"/a/"
,
3
,
"/ab/c"
)
==
-
1
);
ASSERT
(
mg_match_prefix
(
"/blog/"
,
6
,
"/"
)
==
-
1
);
ASSERT
(
mg_match_prefix
(
"/*/"
,
3
,
"/ab/c"
)
==
4
);
ASSERT
(
mg_match_prefix
(
"**"
,
2
,
"/a/b/c"
)
==
6
);
ASSERT
(
mg_match_prefix
(
"/*"
,
2
,
"/a/b/c"
)
==
2
);
...
...
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