add: more debugging

add: more options for testing
This commit is contained in:
Tobias Reisinger 2020-08-14 23:18:22 +02:00
parent 0efbd2a22f
commit e84d54f562
23 changed files with 130 additions and 63 deletions
src/handlers

View file

@ -93,7 +93,7 @@ handle_http_request(struct mg_connection *nc, struct http_message *hm)
LOGGER_DEBUG("failed to normalize uri %.*s\n", hm->uri.len, hm->uri.p);
return;
}
LOGGER_DEBUG("requested file: %.*s\n", hm->uri.len, hm->uri.p);
LOGGER_DEBUG("no endpoint found - serving file\n");
char *request_file_org = malloc(sizeof(char) * hm->uri.len);
strncpy(request_file_org, hm->uri.p + 1, hm->uri.len);
@ -174,8 +174,9 @@ handler_http(struct mg_connection *nc, int ev, void *p)
{
char addr[32];
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr), MG_SOCK_STRINGIFY_IP);
LOGGER_DEBUG("new http request from %s\n", addr);
struct http_message *hm = (struct http_message*)p;
LOGGER_DEBUG("======================================\n");
LOGGER_DEBUG("new http %.*s request from %s for %.*s\n", hm->method.len, hm->method.p, addr, hm->uri.len, hm->uri.p);
handle_http_request(nc, hm);
}
}