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