Author: gonzalo
Date: 2005-04-29 15:30:51 -0400 (Fri, 29 Apr 2005)
New Revision: 43802
Modified:
trunk/mcs/class/System/System.Net/BasicClient.cs
trunk/mcs/class/System/System.Net/ChangeLog
Log:
2005-04-29 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* BasicClient.cs: firefox/IE just send latin1, stripping the high byte
from unicode >= 256 characters.
Modified: trunk/mcs/class/System/System.Net/BasicClient.cs
===================================================================
--- trunk/mcs/class/System/System.Net/BasicClient.cs 2005-04-29 18:44:34 UTC
(rev 43801)
+++ trunk/mcs/class/System/System.Net/BasicClient.cs 2005-04-29 19:30:51 UTC
(rev 43802)
@@ -33,8 +33,6 @@
{
class BasicClient : IAuthenticationModule
{
- static Encoding Latin1 = Encoding.GetEncoding (28591);
-
public Authorization Authenticate (string challenge, WebRequest
webRequest, ICredentials credentials)
{
if (credentials == null || challenge == null)
@@ -47,6 +45,16 @@
return InternalAuthenticate (webRequest, credentials);
}
+ static byte [] GetBytes (string str)
+ {
+ int i = str.Length;
+ byte [] result = new byte [i];
+ for (--i; i >= 0; i--)
+ result [i] = (byte) str [i];
+
+ return result;
+ }
+
static Authorization InternalAuthenticate (WebRequest
webRequest, ICredentials credentials)
{
HttpWebRequest request = webRequest as HttpWebRequest;
@@ -65,12 +73,11 @@
string domain = cred.Domain;
byte [] bytes;
- // If Latin1 is not enough, see RFC 2047 to use other
encodings.
// If domain is set, MS sends "domain\user:password".
if (domain == null || domain == "" || domain.Trim () ==
"")
- bytes = Latin1.GetBytes (userName + ":" +
password);
+ bytes = GetBytes (userName + ":" + password);
else
- bytes = Latin1.GetBytes (domain + "\\" +
userName + ":" + password);
+ bytes = GetBytes (domain + "\\" + userName +
":" + password);
string auth = "Basic " + Convert.ToBase64String (bytes);
return new Authorization (auth);
Modified: trunk/mcs/class/System/System.Net/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net/ChangeLog 2005-04-29 18:44:34 UTC (rev
43801)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2005-04-29 19:30:51 UTC (rev
43802)
@@ -1,5 +1,10 @@
2005-04-29 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+ * BasicClient.cs: firefox/IE just send latin1, stripping the high byte
+ from unicode >= 256 characters.
+
+2005-04-29 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
* BasicClient.cs: use latin1 when encoding the username/domain/password.
Fixes bug #74745.
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches