mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-24 20:21:49 +00:00
Show requests in flight
This commit is contained in:
1 parent
62411d039e
commit
137efe2233
1 file changed
+9
-1
@@ -20,10 +20,18 @@ static void signal_handler(int signo) {
|
|||||||
// Simply serve static files from `s_root_dir`
|
// Simply serve static files from `s_root_dir`
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
|
struct mg_http_message *hm = ev_data, tmp = {};
|
||||||
|
struct mg_str unknown = mg_str_n("?", 1), *cl;
|
||||||
struct mg_http_serve_opts opts = {0};
|
struct mg_http_serve_opts opts = {0};
|
||||||
opts.root_dir = s_root_dir;
|
opts.root_dir = s_root_dir;
|
||||||
opts.ssi_pattern = s_ssi_pattern;
|
opts.ssi_pattern = s_ssi_pattern;
|
||||||
mg_http_serve_dir(c, ev_data, &opts);
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
|
mg_http_parse((char *) c->send.buf, c->send.len, &tmp);
|
||||||
|
cl = mg_http_get_header(&tmp, "Content-Length");
|
||||||
|
if (cl == NULL) cl = &unknown;
|
||||||
|
LOG(LL_INFO, ("%.*s %.*s %.*s %.*s", (int) hm->method.len, hm->method.ptr,
|
||||||
|
(int) hm->uri.len, hm->uri.ptr, (int) tmp.uri.len,
|
||||||
|
tmp.uri.ptr, (int) cl->len, cl->ptr));
|
||||||
}
|
}
|
||||||
(void) fn_data;
|
(void) fn_data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user