http: add client info to OnResponse

This commit is contained in:
uwaa 2024-12-02 16:19:22 +00:00
parent c675cd221e
commit 810c6c913e

View file

@ -48,7 +48,7 @@ public sealed class HttpServer
/// <summary>
/// Called when a request has been served a response.
/// </summary>
public event Action<HttpRequest, HttpResponse>? OnResponse;
public event Action<HttpRequest, HttpClientInfo, HttpResponse>? OnResponse;
/// <summary>
/// Called when a request causes an exception.
@ -160,7 +160,7 @@ public sealed class HttpServer
//Execute
HttpResponse? response = (await Router.GetResponse(req, clientInfo, pathSpl)) ?? HttpResponse.NotFound("Router produced no response");
OnResponse?.Invoke(req, response);
OnResponse?.Invoke(req, clientInfo, response);
await response.WriteTo(httpStream).WaitAsync(Timeout);
if (response is SwitchingProtocols swp)