added HttpServer to HttpContext
parent
eb741c9224
commit
a1a55d6d10
|
@ -4,10 +4,22 @@ namespace ln.http
|
||||||
{
|
{
|
||||||
public class HttpContext
|
public class HttpContext
|
||||||
{
|
{
|
||||||
|
public HTTPServer HttpServer { get; }
|
||||||
public HttpRequest Request { get; set; }
|
public HttpRequest Request { get; set; }
|
||||||
public HttpResponse Response { get; set; }
|
public HttpResponse Response { get; set; }
|
||||||
public HttpPrincipal AuthenticatedPrincipal { get; private 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 string RoutableUri { get; set; }
|
||||||
|
|
||||||
public bool Authenticate(HttpAuthenticationDelegate authenticationDelegate)
|
public bool Authenticate(HttpAuthenticationDelegate authenticationDelegate)
|
||||||
|
|
|
@ -53,8 +53,7 @@ namespace ln.http
|
||||||
if (httpRequest == null)
|
if (httpRequest == null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
HttpContext httpContext = new HttpContext()
|
HttpContext httpContext = new HttpContext(this, httpRequest);
|
||||||
{ Request = httpRequest, RoutableUri = httpRequest.RequestUri.AbsolutePath };
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue