jericho     2003/01/24 19:28:30

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpMethodBase.java
  Log:
  Fix a bug not to set an escaped query.
  (The setQueryString method requires an escaped form)
  
  Reported by Joseph Artsimovich <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.97      +14 -8     
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- HttpMethodBase.java       23 Jan 2003 22:47:47 -0000      1.96
  +++ HttpMethodBase.java       25 Jan 2003 03:28:29 -0000      1.97
  @@ -289,6 +289,7 @@
                       parsedURI.getScheme()
                   ); 
               }
  +            // else { FIXME: just in case, is not abolsute uri, then?
   
               // set the path, defaulting to root
               setPath(
  @@ -296,7 +297,7 @@
                   ? "/"
                   : parsedURI.getPath()
               );
  -            setQueryString( parsedURI.getQuery() );
  +            setQueryString( parsedURI.getEscapedQuery() );
   
           } catch ( URIException e ) {
               throw new IllegalArgumentException( 
  @@ -324,7 +325,9 @@
   
           if ( hostConfiguration == null ) {
               // just use a relative URI, the host hasn't been set
  -            return new URI( null, null, path, queryString, null );
  +            URI tmpUri = new URI(null, null, path, null, null);
  +            tmpUri.setEscapedQuery(queryString);
  +            return tmpUri;
           } else {
   
               // we only want to include the port if it's not the default
  @@ -333,14 +336,17 @@
                   port = -1;
               }
   
  -            return new URI(
  +            URI tmpUri = new URI(
                   hostConfiguration.getProtocol().getScheme(),
                   null,
                   hostConfiguration.getHost(),
                   port,
                   path,
  -                queryString
  +                null // to set an escaped form
               );
  +            tmpUri.setEscapedQuery(queryString);
  +            return tmpUri;
  +
           }
   
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to