You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Sung-Gu <je...@apache.org> on 2003/01/25 04:33:47 UTC
Re: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java
Hi,
The URI class is integrated with some part of httpclient now...
But there are some misuses. I just showed exmaples by report.
I don't know path is required to have an escaped form or not...
But setQueryString in HttpMethodBase is, I know...
There is some inconsitent uses internally... as I see.
Sung-Gu
----- Original Message -----
From: <je...@apache.org>
To: <ja...@apache.org>
Sent: Saturday, January 25, 2003 12:28 PM
Subject: cvs commit:
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient
HttpMethodBase.java
> 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 <jo...@dkd.lt>
>
> Revision Changes Path
> 1.97 +14 -8
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethod
Base.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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
Re: Question about parsing of ambiguous URIs
Posted by Oleg Kalnichevski <o....@dplanet.ch>.
Thanks for clarifications, Mike
Cheers
Oleg
On Sun, 2003-01-26 at 07:15, Michael Becke wrote:
> I believe this behavior is correct. The "yadayada/blabla" URI is a
> relative path, like "../index.html". I think what you're looking for
> is called a net path. Net paths are required to begin with "//" (e.g.
> "//yadayada/blabla" ). The BNF for this part is:
>
> net_path = "//" authority [ abs_path ]
> abs_path = "/" path_segments
> rel_path = rel_segment [ abs_path ]
>
> Mike
>
>
> On Saturday, January 25, 2003, at 12:25 PM, Oleg Kalnichevski wrote:
>
> > Sung-Gu
> >
> > Please have a look at the following code snippet:
> >
> > URI uri = new URI( "/yadayada/blabla" );
> > uri.getHost()); // produces null.
> > uri.getPath()); // produces '/yadayada/blabla'.
> >
> > Everything is cool. However the following behavior appears a bit
> > illogical to me:
> >
> > URI uri = new URI( "yadayada/blabla" );
> > uri.getHost()); // produces null. Should not it be 'yadayada'?
> > uri.getPath()); // produces 'host/path'. Should not it be '/blabla'?
> >
> > I believe if uri is incomplete (no explicit protocol specified) and it
> > does not begin with / per default URI class constructor should assume
> > URI to begin with a host name followed by path, rather then a path with
> > host being null.
> >
> > Is there a reason for current behavior of the URI class constructor?
> >
> > Thanks
> >
> > Oleg
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
Oleg Kalnichevski <o....@dplanet.ch>
Re: Question about parsing of ambiguous URIs
Posted by Michael Becke <be...@u.washington.edu>.
I believe this behavior is correct. The "yadayada/blabla" URI is a
relative path, like "../index.html". I think what you're looking for
is called a net path. Net paths are required to begin with "//" (e.g.
"//yadayada/blabla" ). The BNF for this part is:
net_path = "//" authority [ abs_path ]
abs_path = "/" path_segments
rel_path = rel_segment [ abs_path ]
Mike
On Saturday, January 25, 2003, at 12:25 PM, Oleg Kalnichevski wrote:
> Sung-Gu
>
> Please have a look at the following code snippet:
>
> URI uri = new URI( "/yadayada/blabla" );
> uri.getHost()); // produces null.
> uri.getPath()); // produces '/yadayada/blabla'.
>
> Everything is cool. However the following behavior appears a bit
> illogical to me:
>
> URI uri = new URI( "yadayada/blabla" );
> uri.getHost()); // produces null. Should not it be 'yadayada'?
> uri.getPath()); // produces 'host/path'. Should not it be '/blabla'?
>
> I believe if uri is incomplete (no explicit protocol specified) and it
> does not begin with / per default URI class constructor should assume
> URI to begin with a host name followed by path, rather then a path with
> host being null.
>
> Is there a reason for current behavior of the URI class constructor?
>
> Thanks
>
> Oleg
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
Question about parsing of ambiguous URIs
Posted by Oleg Kalnichevski <o....@dplanet.ch>.
Sung-Gu
Please have a look at the following code snippet:
URI uri = new URI( "/yadayada/blabla" );
uri.getHost()); // produces null.
uri.getPath()); // produces '/yadayada/blabla'.
Everything is cool. However the following behavior appears a bit
illogical to me:
URI uri = new URI( "yadayada/blabla" );
uri.getHost()); // produces null. Should not it be 'yadayada'?
uri.getPath()); // produces 'host/path'. Should not it be '/blabla'?
I believe if uri is incomplete (no explicit protocol specified) and it
does not begin with / per default URI class constructor should assume
URI to begin with a host name followed by path, rather then a path with
host being null.
Is there a reason for current behavior of the URI class constructor?
Thanks
Oleg