Renamed ListenerAsyncResult class to HttpListenerAsyncResult class
This commit is contained in:
parent
9c79e28f22
commit
298ed9210e
@ -78,7 +78,7 @@ namespace WebSocketSharp.Net
|
||||
private string _realm;
|
||||
private bool _reuseAddress;
|
||||
private ServerSslConfiguration _sslConfig;
|
||||
private List<ListenerAsyncResult> _waitQueue;
|
||||
private List<HttpListenerAsyncResult> _waitQueue;
|
||||
private object _waitQueueSync;
|
||||
|
||||
#endregion
|
||||
@ -103,7 +103,7 @@ namespace WebSocketSharp.Net
|
||||
|
||||
_prefixes = new HttpListenerPrefixCollection (this);
|
||||
|
||||
_waitQueue = new List<ListenerAsyncResult> ();
|
||||
_waitQueue = new List<HttpListenerAsyncResult> ();
|
||||
_waitQueueSync = ((ICollection) _waitQueue).SyncRoot;
|
||||
}
|
||||
|
||||
@ -485,7 +485,7 @@ namespace WebSocketSharp.Net
|
||||
_connections[connection] = connection;
|
||||
}
|
||||
|
||||
internal ListenerAsyncResult BeginGetContext (ListenerAsyncResult asyncResult)
|
||||
internal HttpListenerAsyncResult BeginGetContext (HttpListenerAsyncResult asyncResult)
|
||||
{
|
||||
CheckDisposed ();
|
||||
if (_prefixes.Count == 0)
|
||||
@ -521,7 +521,7 @@ namespace WebSocketSharp.Net
|
||||
lock (_ctxRegistrySync)
|
||||
_ctxRegistry[context] = context;
|
||||
|
||||
ListenerAsyncResult ares = null;
|
||||
HttpListenerAsyncResult ares = null;
|
||||
lock (_waitQueueSync) {
|
||||
if (_waitQueue.Count == 0) {
|
||||
lock (_ctxQueueSync)
|
||||
@ -612,7 +612,7 @@ namespace WebSocketSharp.Net
|
||||
/// </exception>
|
||||
public IAsyncResult BeginGetContext (AsyncCallback callback, Object state)
|
||||
{
|
||||
return BeginGetContext (new ListenerAsyncResult (callback, state));
|
||||
return BeginGetContext (new HttpListenerAsyncResult (callback, state));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -658,7 +658,7 @@ namespace WebSocketSharp.Net
|
||||
if (asyncResult == null)
|
||||
throw new ArgumentNullException ("asyncResult");
|
||||
|
||||
var ares = asyncResult as ListenerAsyncResult;
|
||||
var ares = asyncResult as HttpListenerAsyncResult;
|
||||
if (ares == null)
|
||||
throw new ArgumentException ("A wrong IAsyncResult.", "asyncResult");
|
||||
|
||||
@ -697,7 +697,7 @@ namespace WebSocketSharp.Net
|
||||
/// </exception>
|
||||
public HttpListenerContext GetContext ()
|
||||
{
|
||||
var ares = BeginGetContext (new ListenerAsyncResult (null, null));
|
||||
var ares = BeginGetContext (new HttpListenerAsyncResult (null, null));
|
||||
ares.InGet = true;
|
||||
|
||||
return EndGetContext (ares);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#region License
|
||||
/*
|
||||
* ListenerAsyncResult.cs
|
||||
* HttpListenerAsyncResult.cs
|
||||
*
|
||||
* This code is derived from System.Net.ListenerAsyncResult.cs of Mono
|
||||
* (http://www.mono-project.com).
|
||||
@ -42,7 +42,7 @@ using System.Threading;
|
||||
|
||||
namespace WebSocketSharp.Net
|
||||
{
|
||||
internal class ListenerAsyncResult : IAsyncResult
|
||||
internal class HttpListenerAsyncResult : IAsyncResult
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@ -66,7 +66,7 @@ namespace WebSocketSharp.Net
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public ListenerAsyncResult (AsyncCallback callback, object state)
|
||||
public HttpListenerAsyncResult (AsyncCallback callback, object state)
|
||||
{
|
||||
_callback = callback;
|
||||
_state = state;
|
||||
@ -114,14 +114,9 @@ namespace WebSocketSharp.Net
|
||||
if (schm == AuthenticationSchemes.Anonymous)
|
||||
return true;
|
||||
|
||||
if (schm == AuthenticationSchemes.None) {
|
||||
context.Response.Close (HttpStatusCode.Forbidden);
|
||||
return false;
|
||||
}
|
||||
|
||||
var req = context.Request;
|
||||
var authRes = req.Headers["Authorization"];
|
||||
if (schm == AuthenticationSchemes.Basic) {
|
||||
var authRes = req.Headers["Authorization"];
|
||||
if (authRes == null || !authRes.StartsWith ("basic", StringComparison.OrdinalIgnoreCase)) {
|
||||
context.Response.CloseWithAuthChallenge (
|
||||
AuthenticationChallenge.CreateBasicChallenge (listener.Realm).ToBasicString ());
|
||||
@ -130,6 +125,7 @@ namespace WebSocketSharp.Net
|
||||
}
|
||||
}
|
||||
else if (schm == AuthenticationSchemes.Digest) {
|
||||
var authRes = req.Headers["Authorization"];
|
||||
if (authRes == null || !authRes.StartsWith ("digest", StringComparison.OrdinalIgnoreCase)) {
|
||||
context.Response.CloseWithAuthChallenge (
|
||||
AuthenticationChallenge.CreateDigestChallenge (listener.Realm).ToDigestString ());
|
||||
@ -158,7 +154,7 @@ namespace WebSocketSharp.Net
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void complete (ListenerAsyncResult asyncResult)
|
||||
private static void complete (HttpListenerAsyncResult asyncResult)
|
||||
{
|
||||
asyncResult._completed = true;
|
||||
|
@ -85,7 +85,6 @@
|
||||
<Compile Include="Net\HttpListenerResponse.cs" />
|
||||
<Compile Include="Net\HttpStreamAsyncResult.cs" />
|
||||
<Compile Include="Net\HttpUtility.cs" />
|
||||
<Compile Include="Net\ListenerAsyncResult.cs" />
|
||||
<Compile Include="Net\RequestStream.cs" />
|
||||
<Compile Include="Net\ResponseStream.cs" />
|
||||
<Compile Include="Net\WebHeaderCollection.cs" />
|
||||
@ -137,6 +136,7 @@
|
||||
<Compile Include="Net\ClientSslConfiguration.cs" />
|
||||
<Compile Include="Net\ServerSslConfiguration.cs" />
|
||||
<Compile Include="Net\SslConfiguration.cs" />
|
||||
<Compile Include="Net\HttpListenerAsyncResult.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user