You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2007/08/11 22:51:48 UTC

svn commit: r564973 - in /jakarta/httpcomponents/oac.hc3x/trunk: release_notes.txt src/java/org/apache/commons/httpclient/URI.java src/test/org/apache/commons/httpclient/TestURI.java

Author: olegk
Date: Sat Aug 11 13:51:47 2007
New Revision: 564973

URL: http://svn.apache.org/viewvc?view=rev&rev=564973
Log:
HTTPCLIENT-679: Fixed RFC3986 compliance problem in URI absolutization code
Contributed by Jeff Dalton <jeffdalton104 at hotmail dot>
Reviewed by Oleg Kalnichevski

Modified:
    jakarta/httpcomponents/oac.hc3x/trunk/release_notes.txt
    jakarta/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/URI.java
    jakarta/httpcomponents/oac.hc3x/trunk/src/test/org/apache/commons/httpclient/TestURI.java

Modified: jakarta/httpcomponents/oac.hc3x/trunk/release_notes.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/oac.hc3x/trunk/release_notes.txt?view=diff&rev=564973&r1=564972&r2=564973
==============================================================================
--- jakarta/httpcomponents/oac.hc3x/trunk/release_notes.txt (original)
+++ jakarta/httpcomponents/oac.hc3x/trunk/release_notes.txt Sat Aug 11 13:51:47 2007
@@ -1,5 +1,9 @@
 Changes since 3.1 RC 1
 
+* [HTTPCLIENT-679] - Fixed RFC3986 compliance problem in URI absolutization
+           code.
+           Contributed by Jeff Dalton <jeffdalton104 at hotmail dot>
+
 * [HTTPCLIENT-676] - Fixed memory leak in MultiThreadedHttpConnectionManager.
            Contributed by Roland Weber <rolandw at apache.org>
 
@@ -10,7 +14,7 @@
            Contributed by Roland Weber <rolandw at apache.org>
 
 * [HTTPCLIENT-651] - Improved API Doc regarding response buffering.
-           Contributed by Ortwin Glück <oglueck at apache.org>
+           Contributed by Ortwin Gl�ck <oglueck at apache.org>
 
 * [HTTPCLIENT-645] - Cookie#compare() changed to do a simple case-sensitive string comparison 
            when comparing path attributes instead of using a static instance of RuleBasedCollator

Modified: jakarta/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/URI.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/URI.java?view=diff&rev=564973&r1=564972&r2=564973
==============================================================================
--- jakarta/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/URI.java (original)
+++ jakarta/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/URI.java Sat Aug 11 13:51:47 2007
@@ -2942,16 +2942,17 @@
 
         // REMINDME: paths are never null
         String base = (basePath == null) ? "" : new String(basePath);
-        int at = base.lastIndexOf('/');
-        if (at != -1) {
-            basePath = base.substring(0, at + 1).toCharArray();
-        }
+
         // _path could be empty
         if (relPath == null || relPath.length == 0) {
             return normalize(basePath);
         } else if (relPath[0] == '/') {
             return normalize(relPath);
         } else {
+            int at = base.lastIndexOf('/');
+            if (at != -1) {
+                basePath = base.substring(0, at + 1).toCharArray();
+            }
             StringBuffer buff = new StringBuffer(base.length() 
                 + relPath.length);
             buff.append((at != -1) ? base.substring(0, at + 1) : "/");

Modified: jakarta/httpcomponents/oac.hc3x/trunk/src/test/org/apache/commons/httpclient/TestURI.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/oac.hc3x/trunk/src/test/org/apache/commons/httpclient/TestURI.java?view=diff&rev=564973&r1=564972&r2=564973
==============================================================================
--- jakarta/httpcomponents/oac.hc3x/trunk/src/test/org/apache/commons/httpclient/TestURI.java (original)
+++ jakarta/httpcomponents/oac.hc3x/trunk/src/test/org/apache/commons/httpclient/TestURI.java Sat Aug 11 13:51:47 2007
@@ -117,7 +117,7 @@
             { "g/", "http", "a", "/b/c/g/", null, null, "http://a/b/c/g/" },
             { "/g", "http", "a", "/g", null, null, "http://a/g" },
             { "//g", "http", "g", null, null, null, "http://g" },
-            { "?y", "http", "a", "/b/c/", "y", null, "http://a/b/c/?y" },
+            { "?y", "http", "a", "/b/c/d;p", "y", null, "http://a/b/c/d;p?y" },
             { "g?y", "http", "a", "/b/c/g", "y", null, "http://a/b/c/g?y" },
             { "#s", "http", "a", "/b/c/d;p", "q", "s", "http://a/b/c/d;p?q#s" },
             { "#", "http", "a", "/b/c/d;p", "q", "", "http://a/b/c/d;p?q#" },