// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
+#if NET_2_0 && SECURITY_DEP
+
using System.Threading;
namespace System.Net {
class ListenerAsyncResult : IAsyncResult {
if (handle != null)
handle.Set ();
- if (cb != null)
+ if ((context.Listener.AuthenticationSchemes == AuthenticationSchemes.Basic || context.Listener.AuthenticationSchemes == AuthenticationSchemes.Negotiate) && context.Request.Headers ["Authorization"] == null) {
+ context.Listener.EndGetContext (this);
+ context.Response.StatusCode = 401;
+ context.Response.Headers ["WWW-Authenticate"] = AuthenticationSchemes.Basic + " realm=\"\"";
+ context.Response.OutputStream.Close ();
+ context.Listener.BeginGetContext (cb, state);
+ } else if (cb != null)
ThreadPool.QueueUserWorkItem (InvokeCallback, this);
}
}