HttpServerUtility.cs: Fix bug in UrlPathEncode when URL contains '?'
authorNoam Lampert <noaml@mono-cvs.ximian.com>
Mon, 19 May 2008 07:11:40 +0000 (07:11 -0000)
committerNoam Lampert <noaml@mono-cvs.ximian.com>
Mon, 19 May 2008 07:11:40 +0000 (07:11 -0000)
svn path=/trunk/mcs/; revision=103449

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpServerUtility.cs
mcs/class/System.Web/Test/System.Web/HttpServerUtilityTest.cs
mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs

index 031c395a8a229bd5c4b21de6ae7069a186709fdb..71ebc1cdcddfc32679a93568543107145cb45603 100644 (file)
@@ -1,3 +1,8 @@
+
+2008-05-19 Noam Lampert <noaml@mainsoft.com>
+
+        * HttpServerUtility.cs: Fix bug in UrlPathEncode when URL contains '?' 
+
 2008-05-12 Noam Lampert <noaml@mainsoft.com>
 
         * HttpApplication.cs: Fix regressions introduced by latest commit
index c0505fcbc84ba559b1a6062770cd6ef746cd5e98..fa343051ebf80256734c601d0cb4879dc4f1be9e 100644 (file)
@@ -355,7 +355,7 @@ namespace System.Web {
                        int idx = s.IndexOf ("?");
                        string s2 = null;
                        if (idx != -1) {
-                               s2 = s.Substring (0, idx-1);
+                               s2 = s.Substring (0, idx);
                                s2 = HttpUtility.UrlEncode (s2) + s.Substring (idx);
                        } else {
                                s2 = HttpUtility.UrlEncode (s);
index 9d93ed9a3c951ca4aa45c53f684a1023c7147a56..a6a48011253f31c8a3501d7cc30f37e7512f5737 100644 (file)
@@ -84,5 +84,14 @@ namespace MonoTests.System.Web {
                        windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
                        Assert.AreEqual ("&#65308;script&#65310;", Encoding.ASCII.GetString (windata), "ok");
                }
+
+               [Test]
+               public void UrlPathEncode2()
+               {
+                       string s = "default.xxx?sdsd=sds";
+                       string s2 = Server.UrlPathEncode(s);
+                       Assert.AreEqual(s, s2, "UrlPathEncode " + s);
+               }               
+
        }
 }
index 501ff3344a06695ec69802c36aa5c76488e05c54..fc55cb5a050a5df07468878611f04d57ec7cd9fc 100644 (file)
@@ -478,6 +478,13 @@ namespace MonoTests.System.Web {
                                Assert.AreEqual (exp, act, "UrlPathEncode " + c.ToString ());
                        }
                }
+        [Test]
+        public void UrlPathEncode2()
+        {
+            string s = "default.xxx?sdsd=sds";
+            string s2 = HttpUtility.UrlPathEncode(s);
+            Assert.AreEqual(s, s2, "UrlPathEncode " + s);
+        }
 
 #endif