Index: java/org/apache/commons/httpclient/HttpMethodBase.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.38 diff -u -u -r1.38 HttpMethodBase.java --- java/org/apache/commons/httpclient/HttpMethodBase.java 28 Jul 2002 18:08:57 -0000 1.38 +++ java/org/apache/commons/httpclient/HttpMethodBase.java 29 Jul 2002 23:28:19 -0000 @@ -111,7 +111,7 @@ * @author Rodney Waldhoff * @author Sean C. Sullivan * @author dIon Gillard - * @author Jeff Dever + * @author Jeff Dever * @author Davanum Srinivas * @author Ortwin Glück * @version $Revision: 1.38 $ $Date: 2002/07/28 18:08:57 $ @@ -154,10 +154,10 @@ /** * Get the path part of my request. - * @return the path to request + * @return the path to request or "/" if the path is blank. */ public String getPath() { - return this.path; + return (path == null || path.equals("")) ? "/" : path; } /** Index: test/org/apache/commons/httpclient/TestMethodsNoHost.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestMethodsNoHost.java,v retrieving revision 1.4 diff -u -u -r1.4 TestMethodsNoHost.java --- test/org/apache/commons/httpclient/TestMethodsNoHost.java 23 Jul 2002 14:39:14 -0000 1.4 +++ test/org/apache/commons/httpclient/TestMethodsNoHost.java 29 Jul 2002 23:28:20 -0000 @@ -69,8 +69,8 @@ import org.apache.commons.httpclient.methods.*; /** - * @author Jeffrey Dever * @author Rodney Waldhoff + * @author Jeff Dever * @version $Revision: 1.4 $ $Date: 2002/07/23 14:39:14 $ */ public class TestMethodsNoHost extends TestCase { @@ -84,6 +84,23 @@ static final NameValuePair PAIR1 = new NameValuePair(NAME1, VALUE1); static final NameValuePair PAIR2 = new NameValuePair(NAME2, VALUE2); + /** Simple method for testing the HttpMethodBase. + */ + class HttpSimpleMethod extends HttpMethodBase{ + + HttpSimpleMethod(){ + super(); + } + + HttpSimpleMethod(String path){ + super(path); + } ? 6626.diff + + public String getName() { + return "Simple"; + } + + } // ------------------------------------------------------------ Constructor @@ -218,5 +235,45 @@ // expected } } + + public void testHttpMethodBasePaths() throws Exception { + HttpMethod simple = new HttpSimpleMethod(); + String[] paths = { + "/some/absolute/path", + "../some/relative/path", + "/", + "/some/path/with?query=string" + }; + + for (int i=0; i