http://bugzilla.novell.com/show_bug.cgi?id=508027
User [email protected] added comment http://bugzilla.novell.com/show_bug.cgi?id=508027#c2 Gert Driesen <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |[email protected] Resolution|FIXED | --- Comment #2 from Gert Driesen <[email protected]> 2009-06-05 17:10:50 MDT --- According to the MSDN doc page for HttpWebRequest.BeginGetResponse, a ProtocolViolationException is thrown in the following conditions: Method is GET or HEAD, and either ContentLength is greater than zero or SendChunked is true. -or- KeepAlive is true, AllowWriteStreamBuffering is false, and either ContentLength is -1 or SendChunked is false, and Method is POST or PUT. However, starting from .NET 2.0 that exception is no longer thrown in any of these conditions. I've filed a (documentation) bug report against MS for this: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=464686 To reproduce, compile and run the following code: using System; using System.Net; class Program { static void Main () { Uri url = new Uri ("http://www.microsoft.com"); HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url); req.Method = "POST"; req.SendChunked = false; req.KeepAlive = true; req.AllowWriteStreamBuffering = false; try { req.BeginGetResponse (null, null); } catch (ProtocolViolationException ex) { Console.WriteLine (ex.ToString ()); Console.WriteLine (); } finally { req.Abort (); } req = (HttpWebRequest) WebRequest.Create (url); req.Method = "GET"; req.SendChunked = true; try { req.BeginGetResponse (null, null); } catch (ProtocolViolationException ex) { Console.WriteLine (ex.ToString ()); Console.WriteLine (); } finally { req.Abort (); } req = (HttpWebRequest) WebRequest.Create (url); req.Method = "GET"; req.ContentLength = 5; try { req.BeginGetResponse (null, null); } catch (ProtocolViolationException ex) { Console.WriteLine (ex.ToString ()); Console.WriteLine (); } finally { req.Abort (); } } } Expected result: 1.0 profile / .NET 1.x: Three ProtocolViolationExceptions are written to stdout. 2.0 profile (and higher): Successful execution without output to stdout. -- 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
