Skip to content

Commit

Permalink
chore: add log for request
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Aug 24, 2021
1 parent 3ceb2f0 commit 416d79c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,18 @@ static int on_headers_complete(struct http_parser *parser)
struct uh_connection_internal *conn = (struct uh_connection_internal *)parser->data;
struct uh_server_internal *srv = conn->srv;
struct uh_request *req = &conn->req;
struct sockaddr *sa = &conn->addr.sa;
char addr_str[INET6_ADDRSTRLEN];
struct uh_str path;
int port;

http_parser_parse_url(O2D(conn, req->url.offset), req->url.length, false, &conn->url_parser);

path = conn->com.get_path(&conn->com);

log_debug("%s %.*s from %s %d\n", http_method_str(parser->method), (int)path.len, path.p,
addr_str, (saddr2str(sa, addr_str, sizeof(addr_str), &port) ? port : 0));

/* match non wildcard path handler */
if (set_path_handler(conn, srv->handlers, &path, false))
goto done;
Expand Down

0 comments on commit 416d79c

Please sign in to comment.