[Mono-bugs] [Bug 49693][Wis] New - HttpWebRequest can not handle WWW-Authenticate with POST
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 firstname.lastname@example.org.
--- 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 @@
+Product: Mono/Class Libraries
+OS: Red Hat 7.2
+Summary: HttpWebRequest can not handle WWW-Authenticate with POST
+Please fill in this template when reporting a bug, unless you know what you
+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
+The request hangs until it times out.
+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...
+ 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
+ Stream s = req.GetRequestStream ();
+ StreamWriter w = new StreamWriter(s);
+ //Fetch and hang
+ HttpWebResponse res = (HttpWebResponse) req.GetResponse ();