Author: gonzalo
Date: 2005-04-29 14:29:26 -0400 (Fri, 29 Apr 2005)
New Revision: 43799

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: use latin1 when encoding the username/domain/password.
        Fixes bug #74745.



Modified: trunk/mcs/class/System/System.Net/BasicClient.cs
===================================================================
--- trunk/mcs/class/System/System.Net/BasicClient.cs    2005-04-29 18:12:18 UTC 
(rev 43798)
+++ trunk/mcs/class/System/System.Net/BasicClient.cs    2005-04-29 18:29:26 UTC 
(rev 43799)
@@ -33,6 +33,8 @@
 {
        class BasicClient : IAuthenticationModule
        {
+               static Encoding Latin1 = Encoding.GetEncoding (28591);
+
                public Authorization Authenticate (string challenge, WebRequest 
webRequest, ICredentials credentials)
                {
                        if (credentials == null || challenge == null)
@@ -63,11 +65,12 @@
                        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 = Encoding.Default.GetBytes (userName + 
":" + password);
+                               bytes = Latin1.GetBytes (userName + ":" + 
password);
                        else
-                               bytes = Encoding.Default.GetBytes (domain + 
"\\" + userName + ":" + password);
+                               bytes = Latin1.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:12:18 UTC (rev 
43798)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2005-04-29 18:29:26 UTC (rev 
43799)
@@ -1,3 +1,8 @@
+2005-04-29 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * BasicClient.cs: use latin1 when encoding the username/domain/password.
+       Fixes bug #74745.
+
 2005-04-17 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * WebConnectionStream.cs: if the BeginRead/BeginWrite is completed

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to