[Modify] Add another way to get the realm

This commit is contained in:
sta 2016-04-22 15:25:01 +09:00
parent 4246526a1c
commit 9df6d9986c

View File

@ -71,6 +71,7 @@ namespace WebSocketSharp.Net
private Dictionary<HttpListenerContext, HttpListenerContext> _ctxRegistry; private Dictionary<HttpListenerContext, HttpListenerContext> _ctxRegistry;
private object _ctxRegistrySync; private object _ctxRegistrySync;
private Func<IIdentity, NetworkCredential> _credFinder; private Func<IIdentity, NetworkCredential> _credFinder;
private static readonly string _defaultRealm;
private bool _disposed; private bool _disposed;
private bool _ignoreWriteExceptions; private bool _ignoreWriteExceptions;
private volatile bool _listening; private volatile bool _listening;
@ -84,6 +85,15 @@ namespace WebSocketSharp.Net
#endregion #endregion
#region Static Constructor
static HttpListener ()
{
_defaultRealm = "SECRET AREA";
}
#endregion
#region Public Constructors #region Public Constructors
/// <summary> /// <summary>
@ -552,6 +562,12 @@ namespace WebSocketSharp.Net
throw new ObjectDisposedException (GetType ().ToString ()); throw new ObjectDisposedException (GetType ().ToString ());
} }
internal string GetRealm ()
{
var realm = _realm;
return realm != null && realm.Length > 0 ? realm : _defaultRealm;
}
internal bool RegisterContext (HttpListenerContext context) internal bool RegisterContext (HttpListenerContext context)
{ {
if (!_listening) if (!_listening)