[Mono-bugs] [Bug 52621][Wis] New - WebClient stream and StreamReader.Read
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 6 Jan 2004 02:37:18 -0500 (EST)
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 ginga@kit.hi-ho.ne.jp.
http://bugzilla.ximian.com/show_bug.cgi?id=52621
--- shadow/52621 2004-01-06 02:37:18.000000000 -0500
+++ shadow/52621.tmp.16058 2004-01-06 02:37:18.000000000 -0500
@@ -0,0 +1,79 @@
+Bug#: 52621
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ginga@kit.hi-ho.ne.jp
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: WebClient stream and StreamReader.Read
+
+When we get Stream using WebClient.OpenRead() and create StreamReader with
+that Stream object, at last we meet incorrect LF character when we use Read
+().
+
+using System;
+using System.IO;
+using System.Net;
+using System.Text;
+
+public class Test
+{
+ public static void Main ()
+ {
+ string url
+= "http://primates.ximian.com/~atsushi/dummypage.xml";
+ WebClient client = new WebClient ();
+ Stream s = client.OpenRead (url);
+ StreamReader sr = new StreamReader (s, Encoding.UTF8);
+#if true
+ int c = 0;
+ int prev = 0;
+ do {
+ prev = c;
+ c = sr.Read ();
+ Console.Write ((char) c);
+ } while (c >= 0);
+Console.WriteLine ("the last character was " + prev);
+#else
+ Console.Write (sr.ReadToEnd ());
+#endif
+ s.Close ();
+ client.Dispose ();
+ }
+}
+
+
+Actual Results:
+<dummy>
+This file ends with LF
+</dummy>
+
+?the last character was 10
+
+Expected Results:
+<dummy>
+This file ends with LF
+</dummy>
+
+the last character was 10
+
+(note that this does not contain '?' character)
+
+How often does this happen?
+- Always both on Linux (RH9) and Windows (XP).
+
+Additional Information:
+
+In fact MS.NET 1.1 has the same bug (bug I think), so we might choose one
+alternative not to fix this. However, it is helpful to fix existing Xml
+and network stream problem. I have already written fix for them, but this
+bug prevents me to commit the code.