hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marko Asplund (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCLIENT-900) Don't enforce URI syntax
Date Fri, 11 Dec 2009 21:10:18 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789535#action_12789535

Marko Asplund commented on HTTPCLIENT-900:

Note that the URI RFC 2396 classifies '{' and '}' characters as "unwise" characters that should
be escaped but a later version of the RFC (3986) removes this restriction. The URL RFC 1738,
however, classifies these characters as "unsafe" and specifies that they should be escaped.

Since HC Client actually deals with URLs, it might be a good idea to change the URL's internal
representation that HC Client uses from java.net.URI to java.net.URL. Java 6 doesn't have
similar syntax restrictions for URL instances, currently. For backwards compatibility, the
current HttpGet(URI) and HttpGet(String) constructors could continue to work as previously
and still use URI but behind the scenes but the internal representation could be converted
to URL. Additionally a new constructor HttpGet(URL) could be added.

Another option could be to have HC Client implement it's own URL/URI class. The simplest way
would be to use the implementation from Harmony since the projects use the same license. This
class could be made subclassable so that removing possible syntax restrictions could be left
to the HC Client user (the user could pass HttpGet et al. an URI subclass that could skip
certain types of syntax checking).

> Don't enforce URI syntax
> ------------------------
>                 Key: HTTPCLIENT-900
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-900
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>    Affects Versions: 4.0 Final
>            Reporter: Marko Asplund
> I'm trying to use HttpComponents Client for fetching data from a web site.
> I've ran into problems that seem to be related with the way the request URL query parameters
are handled on the server side.
> The service doesn't encode unsafe characters (e.g. '{' and '}') in response URLs.
> Also when these characters are encoded on the client prior to issuing the request the
service gives incorrect responses.
> The URLs are of the following form:
> http://www.foo.bar/foobar?${APPL}=hetekaue
> On the otherhand HC Client doesn't allow me to send requests with invalid query syntax
> (HttpGet(String) constructor throws an URISyntaxException).
> It would be good if HC Client could be used also in situations like this.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message