From ff0b9242e3d4cfdf08bb84fbbbcad6ca2e72cb89 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 14 May 2023 18:44:38 +0200 Subject: net.http.server: Log request and response status lines Points out the beginning and end of a request. --- net/http/server.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'net/http') diff --git a/net/http/server.lua b/net/http/server.lua index ac587435..38c54d8c 100644 --- a/net/http/server.lua +++ b/net/http/server.lua @@ -236,6 +236,8 @@ function handle_request(conn, request, finish_cb) request.headers = headers; request.conn = conn; + request.log("debug", "%s %s HTTP/%s", request.method, request.path, request.httpversion); + local date_header = os_date('!%a, %d %b %Y %H:%M:%S GMT'); -- FIXME use local conn_header = request.headers.connection; conn_header = conn_header and ","..conn_header:gsub("[ \t]", ""):lower().."," or "" @@ -327,6 +329,7 @@ end local function prepare_header(response) local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]); + response.log("debug", "%s", status_line); local headers = response.headers; local output = { status_line }; for k,v in pairs(headers) do -- cgit v1.2.3