hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bronislav Gabrhelík (JIRA) <j...@apache.org>
Subject [jira] [Updated] (HTTPCLIENT-1291) The HttpGet() and likely other method objects should accept only absoluteURI with path specified
Date Mon, 07 Jan 2013 18:56:12 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Bronislav Gabrhelík updated HTTPCLIENT-1291:
--------------------------------------------

    Description: 
Current HttpGet ctor accepts the absoluteURI without  specified path i.e. just with schema
& authority specified. It is somehow handled in the client (on different layer) so request
GET is sent with the absolute root path specified. e.g. "GET / HTTP/1.1". The problem is that
the HttpGet() constructed by that way doesn't work when the HttpClient is configured with
the HTTP proxy. In that case is generated GET request with absolute URI but without the ending
slash. e.g "GET http://www.apache.org HTTP/1.1". This is an inconsistent behavior.

Expected behavior:
I would suggest that the API is more strict and throws some exception when URI is incorrect.
The API is not the edit box of the browser which must be tollerant to the user input. The
GET method doesn't make sense with the path unspecified, so at least one slash should be specified
in URI argument. This issue concerns also other method objects like HttpPut(), HttpDelete(),
etc. I don't think it is a general rule to be applied into HttpUriRequest, but maybe I am
wrong.

e.g.
{code}
HttpGet req = new HttpGet("http://www.apache.org"); // this URI is wrong
HttpGet req = new HttpGet("http://www.apache.org/"); // URI is O.K.
{code}

  was:
Current HttpGet ctor accepts the absoluteURI without  specified path i.e. just with schema
& authority specified. It is somehow handled in the client (on different layer) so request
GET is sent with the absolute root path specified. e.g. "GET / HTTP/1.1". The problem is that
the HttpGet() constructed by that way doesn't work when the HttpClient is configured with
the HTTP proxy. In that case is generated GET request with absolute URI but without the ending
slash. e.g "GET http://www.apache.org HTTP/1.1". This is an inconsistent behavior.

Expected behavior:
GET method doesn't make sense without the path specified, so at least one slash should be
specified. It concerns also other method objects like HttpPut(), HttpDelete(), etc. I don't
think it is a general rule to be applied into HttpUriRequest, but maybe I am wrong.

e.g.
{code}
HttpGet req = new HttpGet("http://www.apache.org"); // this URI is wrong
HttpGet req = new HttpGet("http://www.apache.org/"); // URI is O.K.
{code}

    
> The HttpGet() and likely other method objects should accept only absoluteURI with path
specified 
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1291
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1291
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.2.2
>         Environment: JRE 1.6.23, Windows 7
>            Reporter: Bronislav Gabrhelík
>
> Current HttpGet ctor accepts the absoluteURI without  specified path i.e. just with schema
& authority specified. It is somehow handled in the client (on different layer) so request
GET is sent with the absolute root path specified. e.g. "GET / HTTP/1.1". The problem is that
the HttpGet() constructed by that way doesn't work when the HttpClient is configured with
the HTTP proxy. In that case is generated GET request with absolute URI but without the ending
slash. e.g "GET http://www.apache.org HTTP/1.1". This is an inconsistent behavior.
> Expected behavior:
> I would suggest that the API is more strict and throws some exception when URI is incorrect.
The API is not the edit box of the browser which must be tollerant to the user input. The
GET method doesn't make sense with the path unspecified, so at least one slash should be specified
in URI argument. This issue concerns also other method objects like HttpPut(), HttpDelete(),
etc. I don't think it is a general rule to be applied into HttpUriRequest, but maybe I am
wrong.
> e.g.
> {code}
> HttpGet req = new HttpGet("http://www.apache.org"); // this URI is wrong
> HttpGet req = new HttpGet("http://www.apache.org/"); // URI is O.K.
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message