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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 15 Oct 2003 11:57:18 -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 pra@tim.se.


--- shadow/49693	2003-10-15 11:57:18.000000000 -0400
+++ shadow/49693.tmp.19716	2003-10-15 11:57:18.000000000 -0400
@@ -0,0 +1,69 @@
+Bug#: 49693
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@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 ();