diff --git a/HTTPServer.cs b/HTTPServer.cs index edc6e87..2e25af1 100644 --- a/HTTPServer.cs +++ b/HTTPServer.cs @@ -39,6 +39,7 @@ namespace ln.http Dictionary currentListenerThreads = new Dictionary(); DynamicPool threadPool; + public DynamicPool ThreadPool => threadPool; public HTTPServer() { diff --git a/HTTPServerConnection.cs b/HTTPServerConnection.cs index e417ff4..c46b4d9 100644 --- a/HTTPServerConnection.cs +++ b/HTTPServerConnection.cs @@ -64,7 +64,7 @@ namespace ln.http HttpResponse response = null; - using (CurrentRequest = new HttpRequest(httpReader, (IPEndPoint)TcpClient.Client.LocalEndPoint)) + using (CurrentRequest = new HttpRequest(this.HTTPServer,httpReader, (IPEndPoint)TcpClient.Client.LocalEndPoint)) { CurrentRequest.ApplySession(HTTPServer.SessionCache); diff --git a/HttpRequest.cs b/HttpRequest.cs index 9cd4ca5..90f6a41 100644 --- a/HttpRequest.cs +++ b/HttpRequest.cs @@ -15,7 +15,9 @@ namespace ln.http Dictionary requestHeaders; Dictionary requestCookies; - public IPEndPoint RemoteEndpoint { get; private set; } + public HTTPServer HTTPServer { get; } + + public IPEndPoint RemoteEndpoint { get; private set; } public IPEndPoint LocalEndpoint { get; private set; } public Uri BaseURI { get; set; } @@ -52,8 +54,9 @@ namespace ln.http byte[] requestBody; Stream connectionStream; - public HttpRequest(HttpReader httpReader,IPEndPoint localEndpoint) + public HttpRequest(HTTPServer httpServer, HttpReader httpReader, IPEndPoint localEndpoint) { + HTTPServer = httpServer; connectionStream = httpReader.Stream; LocalEndpoint = localEndpoint; @@ -75,7 +78,7 @@ namespace ln.http { int nread = httpReader.ReadRequestBody(requestBody, 0, clength); if (nread != clength) - throw new HttpException(500,"failed to read request content"); + throw new HttpException(500, "failed to read request content"); } ContentStream = new MemoryStream(requestBody); diff --git a/websocket/WebSocket.cs b/websocket/WebSocket.cs index 5201b72..82be50e 100644 --- a/websocket/WebSocket.cs +++ b/websocket/WebSocket.cs @@ -34,6 +34,7 @@ namespace ln.http.websocket public class WebSocket { + public HTTPServer HTTPServer => HttpRequest.HTTPServer; public HttpRequest HttpRequest { get; } public Stream Stream { get; }