Fixed spelling of HttpServer
parent
40e4eddbbd
commit
4f70676328
|
@ -12,7 +12,7 @@ namespace ln.http.tests
|
||||||
{
|
{
|
||||||
public class Tests
|
public class Tests
|
||||||
{
|
{
|
||||||
HTTPServer server;
|
HttpServer server;
|
||||||
int testPort;
|
int testPort;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
@ -21,7 +21,7 @@ namespace ln.http.tests
|
||||||
if (server != null)
|
if (server != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
server = new HTTPServer();
|
server = new HttpServer();
|
||||||
|
|
||||||
HttpRouter testRouter = new HttpRouter(server);
|
HttpRouter testRouter = new HttpRouter(server);
|
||||||
testRouter.Map(HttpMethod.ANY, "/controller/*", HttpRoutePriority.NORMAL, new TestApiController().Route);
|
testRouter.Map(HttpMethod.ANY, "/controller/*", HttpRoutePriority.NORMAL, new TestApiController().Route);
|
||||||
|
|
|
@ -12,15 +12,15 @@ namespace ln.http
|
||||||
|
|
||||||
private IPEndPoint _localEndPoint;
|
private IPEndPoint _localEndPoint;
|
||||||
private Socket _socket;
|
private Socket _socket;
|
||||||
private HTTPServer _httpServer;
|
private HttpServer _httpServer;
|
||||||
|
|
||||||
public IPEndPoint LocalEndpoint => _localEndPoint;
|
public IPEndPoint LocalEndpoint => _localEndPoint;
|
||||||
|
|
||||||
public HttpListener(HTTPServer httpServer) : this(httpServer, DefaultPort)
|
public HttpListener(HttpServer httpServer) : this(httpServer, DefaultPort)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpListener(HTTPServer httpServer, int port)
|
public HttpListener(HttpServer httpServer, int port)
|
||||||
{
|
{
|
||||||
_httpServer = httpServer;
|
_httpServer = httpServer;
|
||||||
_localEndPoint = new IPEndPoint(IPAddress.IPv6Any, port);
|
_localEndPoint = new IPEndPoint(IPAddress.IPv6Any, port);
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace ln.http
|
||||||
{ public class HttpRequest : IDisposable
|
{ public class HttpRequest : IDisposable
|
||||||
{
|
{
|
||||||
public Request BaseRequest { get; }
|
public Request BaseRequest { get; }
|
||||||
public HTTPServer Server { get; }
|
public HttpServer Server { get; }
|
||||||
|
|
||||||
public String Protocol => BaseRequest.Protocol;
|
public String Protocol => BaseRequest.Protocol;
|
||||||
public HttpMethod Method { get; }
|
public HttpMethod Method { get; }
|
||||||
|
@ -33,7 +33,7 @@ namespace ln.http
|
||||||
Dictionary<string, String> requestParameters;
|
Dictionary<string, String> requestParameters;
|
||||||
|
|
||||||
|
|
||||||
public HttpRequest(HTTPServer httpServer, Request baseRequest)
|
public HttpRequest(HttpServer httpServer, Request baseRequest)
|
||||||
{
|
{
|
||||||
Server = httpServer;
|
Server = httpServer;
|
||||||
BaseRequest = baseRequest;
|
BaseRequest = baseRequest;
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace ln.http
|
||||||
public event HttpAuthenticationDelegate AuthenticationDelegates;
|
public event HttpAuthenticationDelegate AuthenticationDelegates;
|
||||||
|
|
||||||
private List<HttpMapping>[] _mappings = new List<HttpMapping>[5];
|
private List<HttpMapping>[] _mappings = new List<HttpMapping>[5];
|
||||||
private HTTPServer _httpServer;
|
private HttpServer _httpServer;
|
||||||
|
|
||||||
public HttpRouter()
|
public HttpRouter()
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace ln.http
|
||||||
_mappings[n] = new List<HttpMapping>();
|
_mappings[n] = new List<HttpMapping>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpRouter(HTTPServer httpServer)
|
public HttpRouter(HttpServer httpServer)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
_httpServer = httpServer;
|
_httpServer = httpServer;
|
||||||
|
@ -130,7 +130,7 @@ namespace ln.http
|
||||||
Method = httpMethod;
|
Method = httpMethod;
|
||||||
UriRegex = new Regex(reUri);
|
UriRegex = new Regex(reUri);
|
||||||
RouterDelegate = routerDelegate;
|
RouterDelegate = routerDelegate;
|
||||||
AuthenticationRequired = HTTPServer.DefaultRouteAuthentication;
|
AuthenticationRequired = HttpServer.DefaultRouteAuthentication;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpMapping UseFilter(HttpFilterDelegate filterDelegate)
|
public HttpMapping UseFilter(HttpFilterDelegate filterDelegate)
|
||||||
|
|
|
@ -9,7 +9,7 @@ using ln.protocols.helper;
|
||||||
|
|
||||||
namespace ln.http
|
namespace ln.http
|
||||||
{
|
{
|
||||||
public class HTTPServer
|
public class HttpServer
|
||||||
{
|
{
|
||||||
public static bool DefaultRouteAuthentication { get; set; } = false;
|
public static bool DefaultRouteAuthentication { get; set; } = false;
|
||||||
|
|
||||||
|
@ -18,14 +18,14 @@ namespace ln.http
|
||||||
|
|
||||||
public TextWriter LoggingWriter { get; set; }
|
public TextWriter LoggingWriter { get; set; }
|
||||||
|
|
||||||
public HTTPServer() : this(Console.Out)
|
public HttpServer() : this(Console.Out)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public HTTPServer(TextWriter loggingWriter)
|
public HttpServer(TextWriter loggingWriter)
|
||||||
{
|
{
|
||||||
LoggingWriter = loggingWriter;
|
LoggingWriter = loggingWriter;
|
||||||
}
|
}
|
||||||
public HTTPServer(HttpRouterDelegate router)
|
public HttpServer(HttpRouterDelegate router)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
AddRouter(router);
|
AddRouter(router);
|
|
@ -18,16 +18,16 @@ namespace ln.http
|
||||||
|
|
||||||
private IPEndPoint _localEndPoint;
|
private IPEndPoint _localEndPoint;
|
||||||
private Socket _socket;
|
private Socket _socket;
|
||||||
private HTTPServer _httpServer;
|
private HttpServer _httpServer;
|
||||||
|
|
||||||
private X509Certificate _defaultCertificate;
|
private X509Certificate _defaultCertificate;
|
||||||
private Dictionary<string, X509Certificate> _certificateCache = new Dictionary<string, X509Certificate>();
|
private Dictionary<string, X509Certificate> _certificateCache = new Dictionary<string, X509Certificate>();
|
||||||
|
|
||||||
public HttpsListener(HTTPServer httpServer) : this(httpServer, DefaultPort)
|
public HttpsListener(HttpServer httpServer) : this(httpServer, DefaultPort)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpsListener(HTTPServer httpServer, int port)
|
public HttpsListener(HttpServer httpServer, int port)
|
||||||
{
|
{
|
||||||
_httpServer = httpServer;
|
_httpServer = httpServer;
|
||||||
_localEndPoint = new IPEndPoint(IPAddress.IPv6Any, port);
|
_localEndPoint = new IPEndPoint(IPAddress.IPv6Any, port);
|
||||||
|
|
|
@ -29,16 +29,16 @@ namespace ln.http.router
|
||||||
List<string> indexNames = new List<string>();
|
List<string> indexNames = new List<string>();
|
||||||
public String[] IndexNames => indexNames.ToArray();
|
public String[] IndexNames => indexNames.ToArray();
|
||||||
|
|
||||||
private HTTPServer _httpServer;
|
private HttpServer _httpServer;
|
||||||
|
|
||||||
|
|
||||||
public StaticRouter(HTTPServer httpServer)
|
public StaticRouter(HttpServer httpServer)
|
||||||
{
|
{
|
||||||
_httpServer = httpServer;
|
_httpServer = httpServer;
|
||||||
httpServer.AddRouter(this.Route);
|
httpServer.AddRouter(this.Route);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StaticRouter(HTTPServer httpServer, string path)
|
public StaticRouter(HttpServer httpServer, string path)
|
||||||
:this(path)
|
:this(path)
|
||||||
{
|
{
|
||||||
_httpServer = httpServer;
|
_httpServer = httpServer;
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace ln.http.websocket
|
||||||
|
|
||||||
public abstract class WebSocket
|
public abstract class WebSocket
|
||||||
{
|
{
|
||||||
public HTTPServer HTTPServer => HttpRequest.Server;
|
public HttpServer HTTPServer => HttpRequest.Server;
|
||||||
public HttpRequest HttpRequest { get; }
|
public HttpRequest HttpRequest { get; }
|
||||||
public Stream Stream { get; }
|
public Stream Stream { get; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue