From a1a55d6d10b9786015c56e96572efed7b050bc9a Mon Sep 17 00:00:00 2001 From: Harald Wolff-Thobaben Date: Sat, 28 May 2022 19:14:57 +0200 Subject: [PATCH] added HttpServer to HttpContext --- ln.http/HttpContext.cs | 14 +++++++++++++- ln.http/HttpServer.cs | 3 +-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ln.http/HttpContext.cs b/ln.http/HttpContext.cs index c500aa8..27beaea 100644 --- a/ln.http/HttpContext.cs +++ b/ln.http/HttpContext.cs @@ -4,10 +4,22 @@ namespace ln.http { public class HttpContext { + public HTTPServer HttpServer { get; } public HttpRequest Request { get; set; } public HttpResponse Response { get; set; } public HttpPrincipal AuthenticatedPrincipal { get; private set; } - + + public HttpContext(HTTPServer httpServer) + { + HttpServer = httpServer; + } + + public HttpContext(HTTPServer httpServer, HttpRequest httpRequest) : this(httpServer) + { + Request = httpRequest; + RoutableUri = httpRequest.RequestUri.AbsolutePath; + } + public string RoutableUri { get; set; } public bool Authenticate(HttpAuthenticationDelegate authenticationDelegate) diff --git a/ln.http/HttpServer.cs b/ln.http/HttpServer.cs index 2176d8d..253af21 100644 --- a/ln.http/HttpServer.cs +++ b/ln.http/HttpServer.cs @@ -53,8 +53,7 @@ namespace ln.http if (httpRequest == null) break; - HttpContext httpContext = new HttpContext() - { Request = httpRequest, RoutableUri = httpRequest.RequestUri.AbsolutePath }; + HttpContext httpContext = new HttpContext(this, httpRequest); try {