mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Remove debug logs
This commit is contained in:
parent
457d76b049
commit
ed1a98c381
@ -1020,7 +1020,7 @@ static void listdir(struct mg_connection *c, struct mg_http_message *hm,
|
|||||||
memcpy(c->send.buf + off - 10, tmp, n); // Set content length
|
memcpy(c->send.buf + off - 10, tmp, n); // Set content length
|
||||||
} else {
|
} else {
|
||||||
mg_http_reply(c, 400, "", "Cannot open dir");
|
mg_http_reply(c, 400, "", "Cannot open dir");
|
||||||
LOG(LL_DEBUG, ("%lu opendir(%s) -> %d", c->id, dir, errno));
|
LOG(LL_ERROR, ("%lu opendir(%s) -> %d", c->id, dir, errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1033,8 +1033,6 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm,
|
|||||||
if (realpath(opts->root_dir, t1) == NULL)
|
if (realpath(opts->root_dir, t1) == NULL)
|
||||||
LOG(LL_ERROR, ("realpath(%s): %d", opts->root_dir, errno));
|
LOG(LL_ERROR, ("realpath(%s): %d", opts->root_dir, errno));
|
||||||
|
|
||||||
LOG(LL_DEBUG, ("realpath(%s) -> [%s] %zu", opts->root_dir, t1, sizeof(t1)));
|
|
||||||
|
|
||||||
if (!mg_is_dir(t1)) {
|
if (!mg_is_dir(t1)) {
|
||||||
mg_http_reply(c, 400, "", "Bad web root [%s]\n", t1);
|
mg_http_reply(c, 400, "", "Bad web root [%s]\n", t1);
|
||||||
} else {
|
} else {
|
||||||
@ -1057,8 +1055,6 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm,
|
|||||||
is_index = true;
|
is_index = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LL_DEBUG, (" --> [%s] [%s] %zu", t1, t2, sizeof(t1)));
|
|
||||||
|
|
||||||
if (strlen(t2) < n1 || memcmp(t1, t2, n1) != 0) {
|
if (strlen(t2) < n1 || memcmp(t1, t2, n1) != 0) {
|
||||||
// Requested file is located outside root directory, fail
|
// Requested file is located outside root directory, fail
|
||||||
mg_http_reply(c, 404, "", "Not found %.*s\n", hm->uri.len, hm->uri.ptr);
|
mg_http_reply(c, 404, "", "Not found %.*s\n", hm->uri.len, hm->uri.ptr);
|
||||||
|
@ -600,7 +600,7 @@ static void listdir(struct mg_connection *c, struct mg_http_message *hm,
|
|||||||
memcpy(c->send.buf + off - 10, tmp, n); // Set content length
|
memcpy(c->send.buf + off - 10, tmp, n); // Set content length
|
||||||
} else {
|
} else {
|
||||||
mg_http_reply(c, 400, "", "Cannot open dir");
|
mg_http_reply(c, 400, "", "Cannot open dir");
|
||||||
LOG(LL_DEBUG, ("%lu opendir(%s) -> %d", c->id, dir, errno));
|
LOG(LL_ERROR, ("%lu opendir(%s) -> %d", c->id, dir, errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -613,8 +613,6 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm,
|
|||||||
if (realpath(opts->root_dir, t1) == NULL)
|
if (realpath(opts->root_dir, t1) == NULL)
|
||||||
LOG(LL_ERROR, ("realpath(%s): %d", opts->root_dir, errno));
|
LOG(LL_ERROR, ("realpath(%s): %d", opts->root_dir, errno));
|
||||||
|
|
||||||
LOG(LL_DEBUG, ("realpath(%s) -> [%s] %zu", opts->root_dir, t1, sizeof(t1)));
|
|
||||||
|
|
||||||
if (!mg_is_dir(t1)) {
|
if (!mg_is_dir(t1)) {
|
||||||
mg_http_reply(c, 400, "", "Bad web root [%s]\n", t1);
|
mg_http_reply(c, 400, "", "Bad web root [%s]\n", t1);
|
||||||
} else {
|
} else {
|
||||||
@ -637,8 +635,6 @@ void mg_http_serve_dir(struct mg_connection *c, struct mg_http_message *hm,
|
|||||||
is_index = true;
|
is_index = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LL_DEBUG, (" --> [%s] [%s] %zu", t1, t2, sizeof(t1)));
|
|
||||||
|
|
||||||
if (strlen(t2) < n1 || memcmp(t1, t2, n1) != 0) {
|
if (strlen(t2) < n1 || memcmp(t1, t2, n1) != 0) {
|
||||||
// Requested file is located outside root directory, fail
|
// Requested file is located outside root directory, fail
|
||||||
mg_http_reply(c, 404, "", "Not found %.*s\n", hm->uri.len, hm->uri.ptr);
|
mg_http_reply(c, 404, "", "Not found %.*s\n", hm->uri.len, hm->uri.ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user