mail-archives/mono-bugs/2006-February/038873.html

135 строки
5.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 77432][Maj] Changed - System.Net.HttpListener
hangs reading past end of a non-chunked response
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%2077432%5D%5BMaj%5D%20Changed%20-%20System.Net.HttpListener%0A%09hangs%20reading%20past%20end%20of%20a%20non-chunked%20response&In-Reply-To=bug-77432%40chernobyl.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="038872.html">
<LINK REL="Next" HREF="038874.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 77432][Maj] Changed - System.Net.HttpListener
hangs reading past end of a non-chunked response</H1>
<B>bugzilla-daemon at bugzilla.ximian.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%2077432%5D%5BMaj%5D%20Changed%20-%20System.Net.HttpListener%0A%09hangs%20reading%20past%20end%20of%20a%20non-chunked%20response&In-Reply-To=bug-77432%40chernobyl.ximian.com"
TITLE="[Mono-bugs] [Bug 77432][Maj] Changed - System.Net.HttpListener
hangs reading past end of a non-chunked response">bugzilla-daemon at bugzilla.ximian.com
</A><BR>
<I>Thu Feb 2 04:52:56 EST 2006</I>
<P><UL>
<LI>Previous message: <A HREF="038872.html">[Mono-bugs] [Bug 77234][Maj] Changed - nunit-gui: nunit-gui 2.2.5
crashes on startup
</A></li>
<LI>Next message: <A HREF="038874.html">[Mono-bugs] [Bug 77432][Maj] Changed - System.Net.HttpListener
hangs reading past end of a non-chunked response
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#38873">[ date ]</a>
<a href="thread.html#38873">[ thread ]</a>
<a href="subject.html#38873">[ subject ]</a>
<a href="author.html#38873">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">horst.reiterer at mind-breeze.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=77432">http://bugzilla.ximian.com/show_bug.cgi?id=77432</A>
--- 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 <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">horst.reiterer at mind-breeze.com</A> 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 &quot;Expect:
+100-continue&quot; 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 &gt; 0)
++ continue100 = true;
+ webHeaders.SetInternal
+(&quot;Content-Length&quot;, contentLength.ToString ());
+ webHeaders.RemoveInternal
+(&quot;Transfer-Encoding&quot;);
+ } 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, &quot;this property returns Null if no data is sent with
+the request.&quot;. 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 &amp;&amp; content_length &gt;
+0)) {
++ input_stream =
+context.Connection.GetRequestStream (is_chunked);
++ }
++
+ if (Headers [&quot;Expect&quot;] == &quot;100-continue&quot;) {
+ ResponseStream output =
+context.Connection.GetResponseStream ();
+ output.InternalWrite (_100continue, 0,
+_100continue.Length);
+
+The bug related to chunked encoding represents a separate issue.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="038872.html">[Mono-bugs] [Bug 77234][Maj] Changed - nunit-gui: nunit-gui 2.2.5
crashes on startup
</A></li>
<LI>Next message: <A HREF="038874.html">[Mono-bugs] [Bug 77432][Maj] Changed - System.Net.HttpListener
hangs reading past end of a non-chunked response
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#38873">[ date ]</a>
<a href="thread.html#38873">[ thread ]</a>
<a href="subject.html#38873">[ subject ]</a>
<a href="author.html#38873">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>