Fix for pull request #85, renamed DefaultSslConfiguration property to SslConfiguration property
This commit is contained in:
parent
912b1f0d62
commit
689cc28532
@ -28,8 +28,8 @@ namespace Example3
|
||||
#endif
|
||||
/* To provide the secure connection.
|
||||
var cert = ConfigurationManager.AppSettings["ServerCertFile"];
|
||||
var password = ConfigurationManager.AppSettings["CertFilePassword"];
|
||||
httpsv.Certificate = new X509Certificate2 (cert, password);
|
||||
var passwd = ConfigurationManager.AppSettings["CertFilePassword"];
|
||||
httpsv.SslConfiguration.ServerCertificate = new X509Certificate2 (cert, passwd);
|
||||
*/
|
||||
|
||||
/* To provide the HTTP Authentication (Basic/Digest).
|
||||
|
@ -114,7 +114,7 @@ namespace WebSocketSharp.Net
|
||||
port,
|
||||
secure,
|
||||
httpListener.CertificateFolderPath,
|
||||
httpListener.DefaultSslConfiguration,
|
||||
httpListener.SslConfiguration,
|
||||
httpListener.ReuseAddress);
|
||||
|
||||
eps[port] = epl;
|
||||
|
@ -71,13 +71,13 @@ namespace WebSocketSharp.Net
|
||||
private Dictionary<HttpListenerContext, HttpListenerContext> _ctxRegistry;
|
||||
private object _ctxRegistrySync;
|
||||
private Func<IIdentity, NetworkCredential> _credFinder;
|
||||
private ServerSslAuthConfiguration _defaultSslConfig;
|
||||
private bool _disposed;
|
||||
private bool _ignoreWriteExceptions;
|
||||
private bool _listening;
|
||||
private HttpListenerPrefixCollection _prefixes;
|
||||
private string _realm;
|
||||
private bool _reuseAddress;
|
||||
private ServerSslAuthConfiguration _sslConfig;
|
||||
private List<ListenerAsyncResult> _waitQueue;
|
||||
private object _waitQueueSync;
|
||||
|
||||
@ -219,29 +219,6 @@ namespace WebSocketSharp.Net
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default SSL configuration used to authenticate the server and
|
||||
/// optionally the client on the secure connection.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="ServerSslAuthConfiguration"/> that represents the SSL configuration used to
|
||||
/// authenticate the server optionally the client. The default value is <see langword="null"/>.
|
||||
/// </value>
|
||||
/// <exception cref="ObjectDisposedException">
|
||||
/// This listener has been closed.
|
||||
/// </exception>
|
||||
public ServerSslAuthConfiguration DefaultSslConfiguration {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return _defaultSslConfig;
|
||||
}
|
||||
|
||||
set {
|
||||
CheckDisposed ();
|
||||
_defaultSslConfig = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the listener returns exceptions that occur when
|
||||
/// sending the response to the client.
|
||||
@ -329,6 +306,29 @@ namespace WebSocketSharp.Net
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SSL configuration used to authenticate the server and optionally the client
|
||||
/// for secure connection.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="ServerSslAuthConfiguration"/> that represents the configuration used to
|
||||
/// authenticate the server and optionally the client for secure connection.
|
||||
/// </value>
|
||||
/// <exception cref="ObjectDisposedException">
|
||||
/// This listener has been closed.
|
||||
/// </exception>
|
||||
public ServerSslAuthConfiguration SslConfiguration {
|
||||
get {
|
||||
CheckDisposed ();
|
||||
return _sslConfig ?? (_sslConfig = new ServerSslAuthConfiguration (null));
|
||||
}
|
||||
|
||||
set {
|
||||
CheckDisposed ();
|
||||
_sslConfig = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether, when NTLM authentication is used,
|
||||
/// the authentication information of first request is used to authenticate
|
||||
|
@ -336,15 +336,15 @@ namespace WebSocketSharp.Server
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SSL configuration used to authenticate the server and optionally the client
|
||||
/// on the secure connection.
|
||||
/// for secure connection.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="ServerSslAuthConfiguration"/> that represents the SSL configuration used to
|
||||
/// authenticate the server and optionally the client.
|
||||
/// A <see cref="ServerSslAuthConfiguration"/> that represents the configuration used to
|
||||
/// authenticate the server and optionally the client for secure connection.
|
||||
/// </value>
|
||||
public ServerSslAuthConfiguration SslConfiguration {
|
||||
get {
|
||||
return _listener.DefaultSslConfiguration;
|
||||
return _listener.SslConfiguration;
|
||||
}
|
||||
|
||||
set {
|
||||
@ -354,10 +354,7 @@ namespace WebSocketSharp.Server
|
||||
return;
|
||||
}
|
||||
|
||||
if (EndPointListener.CertificateExists (_port, _listener.CertificateFolderPath))
|
||||
_logger.Warn ("The server certificate associated with the port number already exists.");
|
||||
|
||||
_listener.DefaultSslConfiguration = value;
|
||||
_listener.SslConfiguration = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,10 +505,17 @@ namespace WebSocketSharp.Server
|
||||
|
||||
private string checkIfCertificateExists ()
|
||||
{
|
||||
return _secure &&
|
||||
!EndPointListener.CertificateExists (_port, _listener.CertificateFolderPath) &&
|
||||
(_listener.DefaultSslConfiguration == null ||
|
||||
_listener.DefaultSslConfiguration.ServerCertificate == null)
|
||||
if (!_secure)
|
||||
return null;
|
||||
|
||||
var usr = _listener.SslConfiguration.ServerCertificate != null;
|
||||
var port = EndPointListener.CertificateExists (_port, _listener.CertificateFolderPath);
|
||||
if (usr && port) {
|
||||
_logger.Warn ("The server certificate associated with the port number already exists.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return !(usr || port)
|
||||
? "The secure connection requires a server certificate."
|
||||
: null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user