[Mono-bugs] [Bug 77432][Maj] New - System.Net.HttpListener hangs
reading past end of a non-chunked response
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Feb 1 05:31:53 EST 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by pawel.sakowski at mind-breeze.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77432
--- shadow/77432 2006-02-01 05:31:53.000000000 -0500
+++ shadow/77432.tmp.4167 2006-02-01 05:31:53.000000000 -0500
@@ -0,0 +1,71 @@
+Bug#: 77432
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: System
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: pawel.sakowski at mind-breeze.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Net.HttpListener hangs reading past end of a non-chunked response
+
+Description of Problem:
+Upon receiving an HTTP request with a specified Content-Length
+(non-chunked), HttpListener's input stream (System.Net.RequestStream) tries
+to read from the socket (Read accesses the socket instead of returning 0)
+even after having fetched the amount of data specified by the header. Since
+at that point the HTTP client provides no new data, the Read hangs until a
+timeout occurs.
+
+Steps to reproduce the problem:
+1. Test code:
+using System;
+using System.Net;
+class TestClient {
+static void Main() {
+WebRequest req = WebRequest.CreateDefault(new Uri("http://127.0.0.1:5555/"));
+req.Method = "POST";
+req.GetRequestStream().Close();
+req.GetResponse();
+}
+}
+
+using System;
+using System.Net;
+class TestServer {
+static void Main() {
+HttpListener lis = new HttpListener();
+lis.Prefixes.Add("http://*:5555/");
+lis.Start();
+byte[] buf = new byte[100];
+Console.WriteLine("read: "+
+ lis.GetContext().Request.InputStream.Read(buf,0,100));
+}
+}
+
+2. Run TestServer.
+3. Run TestClient.
+
+Actual Results:
+TestServer does not return (until the connection times out).
+
+Expected Results:
+"read: 0" on TestServer's console
+
+How often does this happen?
+always
+
+Additional Information:
+Relevant headers from the HTTP request generated by TestClient:
+Content-Length: 0
+Expect: 100-continue
+
+Microsoft implementation of the System.Net classes provides the expected
+results.
More information about the mono-bugs
mailing list