2004-06-09 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System / System / Uri.cs
index 1c6407b16b271f361534a76d44f8ec495f73d3c6..ddec91998adac4327992ea181c218c6c60e5db64 100755 (executable)
@@ -240,15 +240,18 @@ namespace System
                }               
                
                // Properties
-               
+
                public string AbsolutePath { 
                        get { return path; } 
                }
 
                public string AbsoluteUri { 
-                       get { 
-                               if (cachedAbsoluteUri == null)
-                                       cachedAbsoluteUri = GetLeftPart (UriPartial.Path) + query + fragment;
+                       get {
+                               if (cachedAbsoluteUri == null) {
+//                                     cachedAbsoluteUri = GetLeftPart (UriPartial.Path) + query + fragment;
+                                       string qf = IsFile ? query + fragment : EscapeString (query + fragment);
+                                       cachedAbsoluteUri = GetLeftPart (UriPartial.Path) + qf;
+                               }
                                return cachedAbsoluteUri;
                        } 
                }
@@ -510,12 +513,12 @@ namespace System
                                uri = new Uri (s);
                        }
                        
-                       return ((this.scheme == uri.scheme) &&
-                               (this.userinfo == uri.userinfo) &&
-                               (this.host == uri.host) &&
-                               (this.port == uri.port) &&
-                               (this.path == uri.path) &&
-                               (this.query == uri.query));
+                       return ((this.scheme.ToLower () == uri.scheme.ToLower ()) &&
+                               (this.userinfo.ToLower () == uri.userinfo.ToLower ()) &&
+                               (this.host.ToLower () == uri.host.ToLower ()) &&
+                               (this.port == uri.port) &&
+                               (this.path == uri.path) &&
+                               (this.query.ToLower () == uri.query.ToLower ()));
                }               
                
                public override int GetHashCode () 
@@ -665,10 +668,7 @@ namespace System
                {
                        if (cachedToString != null) 
                                return cachedToString;
-                       if (IsFile && !IsUnc)
-                               cachedToString = Unescape (AbsoluteUri);
-                       else
-                               cachedToString = AbsoluteUri;
+                       cachedToString = Unescape (AbsoluteUri);
 
                        return cachedToString;
                }
@@ -756,7 +756,7 @@ namespace System
                                        s.Append (HexUnescape (str, ref i));
                                        i--;
                                } else
-                                       s.Append (c);                                   
+                                       s.Append (c);
                        }
                        return s.ToString ();
                }
@@ -933,7 +933,7 @@ namespace System
                        path = Reduce (path);
                }
 
-               public static string Reduce (string path)
+               private static string Reduce (string path)
                {
                        path = path.Replace ('\\','/');
                        string [] parts = path.Split ('/');