[Mono-bugs] [Bug 77432][Maj] Changed - System.Net.HttpListener
hangs reading past end of a non-chunked response
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Feb 2 04:52:56 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 horst.reiterer at mind-breeze.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77432
--- shadow/77432 2006-02-01 11:24:49.000000000 -0500
+++ shadow/77432.tmp.18497 2006-02-02 04:52:56.000000000 -0500
@@ -112,6 +112,61 @@
Pretty much anything where the second line !=0.
MS.NET gives:
read: 100
read: 62
+
+------- Additional Comments From horst.reiterer at mind-breeze.com 2006-02-02 04:52 -------
+IMHO, there are two issues here (in respect to the original problem
+reported), the first being that HttpWebRequest sends a header "Expect:
+100-continue" even if the content length is zero. Of course, this is
+useless because the Expect header is only useful for eliminiating
+redundant payload transmissions. The following patch fixes this issue
+(MS CLR compatible):
+
+--- mono-1.1.13.2/mcs/class/System/System.Net/HttpWebRequest.cs
+2005-11-17 17:07:17.000000000 -0500
++++ mono-1.1.13.2-dev/mcs/class/System/System.Net/HttpWebRequest.cs
+2006-02-01 15:02:46.000000000 -0500
+@@ -853,7 +853,8 @@
+ {
+ bool continue100 = false;
+ if (contentLength != -1) {
+- continue100 = true;
++ if (contentLength > 0)
++ continue100 = true;
+ webHeaders.SetInternal
+("Content-Length", contentLength.ToString ());
+ webHeaders.RemoveInternal
+("Transfer-Encoding");
+ } else if (sendChunked) {
+
+Second, the InputStream property of System.Net.HttpListenerRequest
+returns a Stream reference although the payload of the request is zero.
+According to MSDN, "this property returns Null if no data is sent with
+the request.". The following patch fixes that:
+
+--- mono-1.1.13.2/mcs/class/System/System.Net/HttpListenerRequest.cs
+ 2005-11-28 16:03:20.000000000 -0500
++++
+mono-1.1.13.2-dev/mcs/class/System/System.Net/HttpListenerRequest.cs
+ 2006-02-02 04:37:49.000000000 -0500
+@@ -165,7 +165,10 @@
+ return;
+ }
+
+- input_stream =
+context.Connection.GetRequestStream (is_chunked);
++ if (is_chunked || (cl_set && content_length >
+0)) {
++ input_stream =
+context.Connection.GetRequestStream (is_chunked);
++ }
++
+ if (Headers ["Expect"] == "100-continue") {
+ ResponseStream output =
+context.Connection.GetResponseStream ();
+ output.InternalWrite (_100continue, 0,
+_100continue.Length);
+
+The bug related to chunked encoding represents a separate issue.
More information about the mono-bugs
mailing list