aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-05-14 18:44:38 +0200
committerKim Alvefur <zash@zash.se>2023-05-14 18:44:38 +0200
commitff0b9242e3d4cfdf08bb84fbbbcad6ca2e72cb89 (patch)
treeec8dad2c7da417df59eb4fc64a07dcecbbdc9615
parentfe8e6dc8cad5f6f7d774cc9689d26a1b287e9c77 (diff)
downloadprosody-ff0b9242e3d4cfdf08bb84fbbbcad6ca2e72cb89.tar.gz
prosody-ff0b9242e3d4cfdf08bb84fbbbcad6ca2e72cb89.zip
net.http.server: Log request and response status lines
Points out the beginning and end of a request.
-rw-r--r--net/http/server.lua3
1 files changed, 3 insertions, 0 deletions
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