[Mono-bugs] [Bug 50530][Min] Changed - Authenticated POST requests do not work with HTTP/1.0 servers
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 15 Feb 2004 17:52:44 -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 helge.hess@opengroupware.org.
http://bugzilla.ximian.com/show_bug.cgi?id=50530
--- shadow/50530 2004-02-12 13:09:26.000000000 -0500
+++ shadow/50530.tmp.743 2004-02-15 17:52:44.000000000 -0500
@@ -201,6 +201,125 @@
If this still fails for you, please provide all the request/response
headers or, even better, a tcpdump output file.
Thanks.
+
+------- Additional Comments From helge.hess@opengroupware.org 2004-02-15 17:52 -------
+Can't see a difference:
+---snip---
+helge@move:~/projects/mono/HelgeTests> mono --version
+Mono JIT compiler version 0.30.99, (C) 2002-2004 Novell, Inc.
+www.go-mono.com
+---snap---
+(CVS HEAD of today, also checked 0.30.1)
+
+relevant source:
+---snip---
+ NetworkCredential credentials =
+ new NetworkCredential("helge","xxx",null);
+ Uri destination =
+ new Uri("http://localhost:22002/RPC2");
+
+ HttpWebRequest webRequest =
+ (HttpWebRequest)WebRequest.Create(destination);
+ webRequest.Credentials = credentials;
+ webRequest.PreAuthenticate = true;
+ webRequest.ProtocolVersion = HttpVersion.Version10;
+
+ webRequest.Method = "POST";
+ webRequest.ContentType = "text/xml";
+ //webRequest.ExpectContinue = false;
+
+ /* send request */
+
+ Stream rqStream = webRequest.GetRequestStream();
+ StreamWriter sw = new StreamWriter(rqStream);
+ sw.WriteLine("<?xml version='1.0'?>");
+ sw.WriteLine("<a></a>");
+ sw.Flush();
+ sw.Close();
+Console.WriteLine("Sent Rq ...");
+
+ string response;
+
+ try {
+Console.WriteLine("will get response ...");
+ HttpWebResponse webResponse =
+ (HttpWebResponse)webRequest.GetResponse();
+Console.WriteLine("did get response ...");
+
+ if (webRequest.HaveResponse) {
+ StreamReader stream =
+ new StreamReader(webResponse.GetResponseStream());
+ response = stream.ReadToEnd();
+ stream.Close();
+ }
+ else
+ throw new Exception("No response received from host.");
+ }
+ catch(WebException e) {
+ throw new Exception("Exception occured while sending request.",e);
+ }
+---snap---
+
+Test program output:
+---snip---
+helge@move:~/projects/mono/HelgeTests> mono testbasicauth3.exe
+Sent Rq ...
+will get response ...
+System.Exception: Exception occured while sending request. --->
+System.Net.WebException: Error getting response stream --->
+System.Exception:
+ at System.Net.WebConnection.HandleError()
+ at System.Net.WebConnection.ReadDone()
+ at System.MulticastDelegate.invoke_void_IAsyncResult()
+ at System.Net.Sockets.Socket+Worker.End()
+ at System.Net.Sockets.Socket+Worker.Receive()
+in <0x000ee> System.Net.WebConnection:HandleError
+(System.Net.WebExceptionStatus,System.Exception)
+--- End of inner exception stack trace ---
+
+in <0x0007a> System.Net.HttpWebRequest:CheckFinalStatus
+(System.Net.WebAsyncResult)
+in <0x00065> (wrapper remoting-invoke-with-check)
+System.Net.HttpWebRequest:CheckFinalStatus (System.Net.WebAsyncResult)
+in <0x001d5> System.Net.HttpWebRequest:EndGetResponse
+(System.IAsyncResult)
+in <0x00077> System.Net.HttpWebRequest:GetResponse ()
+in <0x001e8> httpclient:Main ()
+--- End of inner exception stack trace ---
+
+in <0x002ed> httpclient:Main ()
+---snap---
+
+HTTP transaction:
+---snip---
+POST /RPC2 HTTP/1.0
+Content-Type: text/xml
+Content-Length: 30
+Expect: 100-continue
+Connection: keep-alive
+Host: localhost
+
+<?xml version='1.0'?>
+<a></a>
+
+Feb 15 22:53:45 xmlrpcd [11484]: response is
+
+HTTP/1.0 401 Authorization Required
+www-authenticate: basic realm="SKYRiX"
+content-length: 0
+---snap---
+
+
+Summary:
+As you can see "ProtocolVersion" now properly results in HTTP/1.0 in
+the request header but still sends Expect: 100-continue.
+
+In addition the HTTP host header is broken - I send on port "22022",
+yet the Host header only lists the host name, it should read:
+---snip---
+Host: localhost:22022
+---snap---
+