mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-14 10:20:01 +00:00
Fix url rewrites
This commit is contained in:
1 parent
b8dfb69cf5
commit
bf7a115bf2
3 files changed
+5
-1
No files matched your search
@@ -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;
|
||||
|
||||
+2
-1
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user