Software /
code /
prosody
Changeset
13100:18ffe7833446
net.http.server: Assign an ID to each request, shared with response
Goal is improve tracking of individual HTTP requests throughout its
life-cycle. Having a single ID to use in logging should help here.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 14 May 2023 18:38:22 +0200 |
parents | 13099:a1ba503610ed |
children | 13101:c975dafa4303 |
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 07 20:34:07 2023 +0200 +++ b/net/http/server.lua Sun May 14 18:38:22 2023 +0200 @@ -14,6 +14,7 @@ local errors = require "prosody.util.error"; local blocksize = 2^16; local async = require "prosody.util.async"; +local id = require"prosody.util.id"; local _M = {}; @@ -128,6 +129,7 @@ end, runner_callbacks, session); local function success_cb(request) --log("debug", "success_cb: %s", request.path); + request.id = id.short(); request.ip = ip; request.secure = secure; session.thread:run(request); @@ -249,6 +251,7 @@ local is_head_request = request.method == "HEAD"; local response = { + id = request.id; request = request; is_head_request = is_head_request; status_code = 200;