Changeset

13102:4e112b87543d

net.http.server: Log request and response status lines Points out the beginning and end of a request.
author Kim Alvefur <zash@zash.se>
date Sun, 14 May 2023 18:44:38 +0200
parents 13101:c975dafa4303
children 13103:42c2a9787242
files net/http/server.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/server.lua	Sun May 14 18:44:11 2023 +0200
+++ b/net/http/server.lua	Sun May 14 18:44:38 2023 +0200
@@ -236,6 +236,8 @@
 	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 @@
 
 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