[Mono-bugs] [Bug 49693][Wis] New - HttpWebRequest can not handle WWW-Authenticate with POST

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 12 Jan 2004 20:10:03 -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 gonzalo@ximian.com.


--- shadow/49693	2004-01-12 20:10:03.000000000 -0500
+++ shadow/49693.tmp.29203	2004-01-12 20:10:03.000000000 -0500
@@ -0,0 +1,78 @@
+Bug#: 49693
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEEDINFO   
+Severity: Unknown
+Priority: Wishlist
+Component: System
+AssignedTo: gonzalo@ximian.com                            
+ReportedBy: pra@tim.se               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: HttpWebRequest can not handle WWW-Authenticate with POST
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+HttpWebRequest seems not to handle 401/WWW-Authenticate challange when used 
+with the POST method. When HttpWebRequest goes into the redirect mode after
+having set up the Authorization it hangs.
+From poking around in the code it seems as if the problem is that to put
+data into a post you use the GetRequestStream. Around that a lot of async
+magic is handled. One of the results seems to be that when doing a new
+round with the authentication in the header, there is no where to get the
+stream to put into the body any longer.
+Steps to reproduce the problem:
+1. Find a website wich requires basic AUTH.
+2. Write a HttpWebRequest that uses POST and GetRequestStream
+Actual Results:
+The request hangs until it times out.
+Expected Results:
+The response from the webservice.
+How often does this happen? 
+There might also be some threading problems. When ading strace statements,
+it randomly hangs at other places...
+Additional Information:
+	HttpWebRequest req = (HttpWebRequest) WebRequest.Create
+        // Setup creds			
+	NetworkCredential  credentials= new NetworkCredential("admin","admin"); 
+	CredentialCache putCache = new CredentialCache(); 
+	putCache.Add(new Uri("http://localhost:8180/jmx-console/"), "Basic",
+	req.Credentials = putCache;
+        // Set up POST
+        req.Method="POST";
+	Stream s = req.GetRequestStream ();
+	StreamWriter w = new StreamWriter(s);
+	w.Write("hello=ug");
+	w.Flush();
+	w.Close();
+        s.Close();
+        //Fetch and hang
+        HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
+------- Additional Comments From gonzalo@ximian.com  2003-11-14 00:12 -------
+Could you please recheck this with current CVS and/or attach a full
+test case?
+------- Additional Comments From gonzalo@ximian.com  2004-01-12 20:10 -------