Merge branch 'bugfix-main-thread-root'
[mono.git] / mcs / class / System / Test / System.Net / HttpListenerRequestTest.cs
index 4b287e470119513becfd8e92b3529a66ee221954..95dc3d2472be22725ae46faf9c6bacd2576e45b4 100644 (file)
@@ -158,9 +158,22 @@ namespace MonoTests.System.Net
                        HttpListenerContext ctx = listener.GetContext ();
                        HttpListenerRequest request = ctx.Request;
                        Assert.AreEqual ("pOsT", request.HttpMethod);
-                       HttpListener2Test.Send (ctx.Response.OutputStream, "%%%OK%%%");
                        listener.Close ();
                }
+               
+               [Test]
+               public void HttpBasicAuthScheme()
+               {
+                       HttpListener listener = HttpListener2Test.CreateAndStartListener("http://*:9000/authTest/", AuthenticationSchemes.Basic);
+                       //dummy-wait for context
+                       listener.BeginGetContext(null, listener);
+                       NetworkStream ns = HttpListener2Test.CreateNS(9000);
+                       HttpListener2Test.Send(ns, "GET /authTest/ HTTP/1.0\r\n\r\n");
+                       String response = HttpListener2Test.Receive(ns, 512);
+                       Assert.IsTrue(response.Contains("WWW-Authenticate: Basic realm"), "#A");
+                       ns.Close();
+                       listener.Close();
+               }
        }
 }