wasSharpNET
/Network/HTTP/HTTPServer.cs |
@@ -15,32 +15,21 @@ |
{ |
private int activeRequests; |
|
private HttpListener HTTPListener = new HttpListener() |
{ |
AuthenticationSchemes = AuthenticationSchemes.None |
}; |
private HttpListener HTTPListener = null; |
|
private int processedRequests; |
|
public AuthenticationSchemes AuthenticationSchemes |
{ |
get |
{ |
return HTTPListener.AuthenticationSchemes; |
} |
set |
{ |
HTTPListener.AuthenticationSchemes = value; |
} |
} |
public AuthenticationSchemes AuthenticationSchemes { get; set; } = |
AuthenticationSchemes.None; |
|
public bool IsRunning => HTTPListener.IsListening; |
public bool IsRunning => HTTPListener != null && HTTPListener.IsListening; |
|
public bool Start(IEnumerable<string> prefixes) |
{ |
// Do not start the HTTP server if it is already running. |
if (HTTPListener.IsListening) |
return false; |
HTTPListener = new HttpListener() |
{ |
AuthenticationSchemes = AuthenticationSchemes |
}; |
|
// Add all prefixes. |
HTTPListener.Prefixes.Clear(); |
@@ -56,10 +45,9 @@ |
return true; |
} |
|
public bool Stop() |
public void Stop() |
{ |
HTTPListener.Stop(); |
return true; |
} |
|
private void Listen(object state) |