added HttpServer to HttpContext

master
Harald Wolff 2022-05-28 19:14:57 +02:00
parent eb741c9224
commit a1a55d6d10
2 changed files with 14 additions and 3 deletions

View File

@ -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)

View File

@ -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
{