On Mon, 2014-07-07 at 17:46 -0400, Nick Chang wrote:
> Hello,
>
> Here is a simple code sniplet to reproduce the issue.
>
> public static void main(String[] args) throws Exception {
> DefaultHttpClient httpclient = new DefaultHttpClient();
> HttpGet httpGet = new HttpGet("http://www.google.com///imghp");
>
> HttpResponse response1 = httpclient.execute(httpGet);
>
> try {
> System.out.println(response1.getStatusLine());
> HttpEntity entity1 = response1.getEntity();
> // do something useful with the response body
> // and ensure it is fully consumed
> EntityUtils.consume(entity1);
> } finally {
> httpGet.releaseConnection();
> }
>
> }
>
> The httpclient library will only send out '/imghp' in the HTTP Request. The
> additional leading slash characters are omitted. Anyway to configure
> DefaultHttpClient to preserve the additional leading slash characters?
>
This is called URI normalization and has nothing to do with HttpClient.
See java.net.URI and RFC 2396.
One cannot make HttpClient 4.2 send requests with a non-normalized URI.
You'll need to upgrade to version 4.3 and use BasicHttpRequest instead
of HttpGet.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]