Fix a few for ListenerAsyncResult.cs

This commit is contained in:
sta 2014-04-06 15:47:07 +09:00
parent 0ba5d61f4a
commit e852787da5

View File

@ -8,7 +8,7 @@
* The MIT License * The MIT License
* *
* Copyright (c) 2005 Ximian, Inc. (http://www.ximian.com) * Copyright (c) 2005 Ximian, Inc. (http://www.ximian.com)
* Copyright (c) 2012-2013 sta.blockhead * Copyright (c) 2012-2014 sta.blockhead
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -33,7 +33,7 @@
#region Authors #region Authors
/* /*
* Authors: * Authors:
* Gonzalo Paniagua Javier <gonzalo@ximian.com> * - Gonzalo Paniagua Javier <gonzalo@ximian.com>
*/ */
#endregion #endregion
@ -124,7 +124,7 @@ namespace WebSocketSharp.Net
internal void Complete (Exception exception) internal void Complete (Exception exception)
{ {
_exception = InGet && (exception is ObjectDisposedException) _exception = InGet && (exception is ObjectDisposedException)
? new HttpListenerException (500, "Listener closed") ? new HttpListenerException (500, "Listener closed.")
: exception; : exception;
lock (_sync) { lock (_sync) {
@ -155,22 +155,20 @@ namespace WebSocketSharp.Net
var header = context.Request.Headers ["Authorization"]; var header = context.Request.Headers ["Authorization"];
if (scheme == AuthenticationSchemes.Basic && if (scheme == AuthenticationSchemes.Basic &&
(header == null || (header == null || !header.StartsWith ("basic", StringComparison.OrdinalIgnoreCase))) {
!header.StartsWith ("basic", StringComparison.OrdinalIgnoreCase))) {
context.Response.CloseWithAuthChallenge ( context.Response.CloseWithAuthChallenge (
HttpUtility.CreateBasicAuthChallenge (listener.Realm)); HttpUtility.CreateBasicAuthChallenge (listener.Realm));
listener.BeginGetContext (this);
listener.BeginGetContext (this);
return; return;
} }
if (scheme == AuthenticationSchemes.Digest && if (scheme == AuthenticationSchemes.Digest &&
(header == null || (header == null || !header.StartsWith ("digest", StringComparison.OrdinalIgnoreCase))) {
!header.StartsWith ("digest", StringComparison.OrdinalIgnoreCase))) {
context.Response.CloseWithAuthChallenge ( context.Response.CloseWithAuthChallenge (
HttpUtility.CreateDigestAuthChallenge (listener.Realm)); HttpUtility.CreateDigestAuthChallenge (listener.Realm));
listener.BeginGetContext (this);
listener.BeginGetContext (this);
return; return;
} }