[Mono-bugs] [Bug 524049] New: HttpWebRequest and StreamWriter ArgumentException when ContentLength set to 0

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 21 18:34:47 EDT 2009


           Summary: HttpWebRequest and StreamWriter ArgumentException when
                    ContentLength set to 0
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: greg.smolyn at strangeloopnetworks.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Created an attachment (id=306686)
 --> (http://bugzilla.novell.com/attachment.cgi?id=306686)
Test case to demonstrate ArgumentException with HttpWebRequest and StreamWriter

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us)
AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19

When the request.ContentLength is set to 0 for a POST operation, the
StreamWriter will throw an ArgumentException when instantiated.

(tested on SVN revision 138308)

Reproducible: Always

Steps to Reproduce:
1.  Create a HttpWebRequest, and set ContentLength to 0
2.  Create a streamwriter based on the request stream
3.  Watch explosion 
(See attachment for repro)
Actual Results:  
Unhandled Exception: System.ArgumentException: Can not write to stream
  at System.IO.StreamWriter..ctor (System.IO.Stream stream,
System.Text.Encoding encoding, Int32 bufferSize) [0x0005f] in
  at System.IO.StreamWriter..ctor (System.IO.Stream stream) [0x00000] 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor
  at HttpsTest.MainClass.Main (System.String[] args) [0x00035] in

Expected Results:  
Connection is created.

This works fine in .NET CLR on Windows.

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list