allow server to be initialised with X509Certificate, for better flexibility
This commit is contained in:
parent
03edb539e3
commit
ae5233c149
@ -21,6 +21,7 @@ namespace Cuipod
|
||||
|
||||
private RequestCallback _onBadRequestCallback;
|
||||
|
||||
//somewhat flaky implementation - probably deprecate it
|
||||
public App(string directoryToServe, string certificateFile, string privateRSAKeyFilePath)
|
||||
{
|
||||
_directoryToServe = directoryToServe;
|
||||
@ -29,6 +30,15 @@ namespace Cuipod
|
||||
_serverCertificate = CertificateUtils.LoadCertificate(certificateFile, privateRSAKeyFilePath);
|
||||
}
|
||||
|
||||
public App(string directoryToServe, X509Certificate2 certificate)
|
||||
{
|
||||
|
||||
_directoryToServe = directoryToServe;
|
||||
_listener = new TcpListener(IPAddress.Any, 1965);
|
||||
_requestCallbacks = new Dictionary<string, RequestCallback>();
|
||||
_serverCertificate = certificate;
|
||||
}
|
||||
|
||||
public void OnRequest(string route, RequestCallback callback)
|
||||
{
|
||||
_requestCallbacks.Add(route, callback);
|
||||
|
||||
Reference in New Issue
Block a user