hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HTTPCLIENT-1064) ExecutionContext returning HttpUriRequest with invalid URI (missing host)
Date Sun, 27 Feb 2011 17:29:39 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-1064.
-------------------------------------------

    Resolution: Invalid

Ted,
Per section 5.1.2 of the RFC 2616 the absolute URI of the target resource is transmitted in
two separate parts: request-URI and Host header.
---
   The most common form of Request-URI is that used to identify a
   resource on an origin server or gateway. In this case the absolute
   path of the URI MUST be transmitted (see section 3.2.1, abs_path) as
   the Request-URI, and the network location of the URI (authority) MUST
   be transmitted in a Host header field. 
---
The request object in the execution context represents the _exact_ composition of the request
message transmitted to the opposite endpoint. Therefore, in case of a direct (non-proxy) connection
to the origin server the request-URI of request messages is relative. The authority part of
the original absolute URI can be obtained as the ExecutionContext.HTTP_TARGET_HOST attribute.

Hope this helps

Oleg  

> ExecutionContext returning HttpUriRequest with invalid URI (missing host)
> -------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1064
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1064
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.1 Final
>         Environment: Windows 7, java 1.6.0.21
>            Reporter: Ted Troccola
>              Labels: HttpClient
>
> The HttpUriRequest contains an invalid URI - host is null
> public static void main(String args[]) throws ClientProtocolException, IOException
> {
>     HttpParams httpParams = new BasicHttpParams();
>     HttpClient httpclient = new DefaultHttpClient(httpParams);
>     HttpGet httpGet = new HttpGet("http://www.google.com/");
>     HttpContext context = new BasicHttpContext();
>     httpclient.execute(httpGet, context);
>     HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
>     System.out.println("New URI host (why is it null?): " + currentReq.getURI().getHost());
> }

-- 
This message is automatically generated by JIRA.
-
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