[Mono-bugs] [Bug 59273][Maj] New - HttpWebResponse.GetResponseStream() Exception when ContentLength == 0 [TEST CASE ATTACHED]

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 28 May 2004 18:03:32 -0400 (EDT)


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 grompf@sublimeintervention.com.

http://bugzilla.ximian.com/show_bug.cgi?id=59273

--- shadow/59273	2004-05-28 18:03:32.000000000 -0400
+++ shadow/59273.tmp.21966	2004-05-28 18:03:32.000000000 -0400
@@ -0,0 +1,32 @@
+Bug#: 59273
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: OSX 10.3.3
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: grompf@sublimeintervention.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: HttpWebResponse.GetResponseStream() Exception when ContentLength == 0 [TEST CASE ATTACHED]
+
+Some web servers can be misconfigured to not send Content-Length even when their is content, 
+as a result HttpWebResponse.ContentLength == 0; however in certain cases we need to still get 
+the stream and check for content.
+
+Calling HttpWebResponse.GetResponseStream on a 0 byte file causes a Unhandled Exception:
+System.ArgumentException: Cannot read stream
+in <0x00124> System.IO.StreamReader:Initialize 
+(System.IO.Stream,System.Text.Encoding,bool,int)
+
+This is inconsistent with the behaviour on the MS runtime.
+
+Expected results:
+
+Return an empty stream.