You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Ilirjan Papa (JIRA)" <ji...@apache.org> on 2012/05/30 18:00:23 UTC

[jira] [Created] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Ilirjan Papa created HTTPCLIENT-1198:
----------------------------------------

             Summary: HttpHost is not set in HttpContext in CachingHttpClient
                 Key: HTTPCLIENT-1198
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.2 Final
            Reporter: Ilirjan Papa
            Priority: Critical


The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.

HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);

The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Closed] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Ilirjan Papa (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ilirjan Papa closed HTTPCLIENT-1198.
------------------------------------


Issue has been resolved.
                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>             Fix For: 4.2.1
>
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Commented] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Ilirjan Papa (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286736#comment-13286736 ] 

Ilirjan Papa commented on HTTPCLIENT-1198:
------------------------------------------

The two most important attributes for us are:

  HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
  HttpUriRequest actualRequest = (HttpUriRequest)requestContext.getAttribute(ExecutionContext.HTTP_REQUEST);


                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Updated] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCLIENT-1198:
------------------------------------------

    Priority: Major  (was: Critical)
    
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>             Fix For: 4.2.1
>
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Resolved] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1198.
-------------------------------------------

       Resolution: Duplicate
    Fix Version/s:     (was: 4.2.1)
    
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Reopened] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski reopened HTTPCLIENT-1198:
-------------------------------------------


My bad. It is a problem with the caching decorator, so it is not a duplicate of HTTPCLIENT-1200. Reopened.

Oleg
                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Assigned] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Jon Moore (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore reassigned HTTPCLIENT-1198:
-------------------------------------

    Assignee: Jon Moore
    
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Commented] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Ilirjan Papa (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13291133#comment-13291133 ] 

Ilirjan Papa commented on HTTPCLIENT-1198:
------------------------------------------

I have successfully tested the fix locally using build 4.2.1-SNAPSHOT that contains the fix.
                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>             Fix For: 4.2.1
>
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Commented] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287412#comment-13287412 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1198:
-----------------------------------------------

@Jon

Sounds reasonable to me. I agree that actual request / response messages should take precedence and be added to the context when available.

Oleg
                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Resolved] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Jon Moore (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore resolved HTTPCLIENT-1198.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2.1

@Ilirjan: I just checked a fix into trunk. Can you see if a build off the SVN trunk fixes your issue?

https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk

                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>             Fix For: 4.2.1
>
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Commented] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Jon Moore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286750#comment-13286750 ] 

Jon Moore commented on HTTPCLIENT-1198:
---------------------------------------

Ok, I'm looking into this now, and fixing this should be straightforward, once we can agree on the behavior. I think, for a cache miss, the CachingHttpClient should just let the underlying HttpClient take care of setting all the context variables. For a pure cache hit, I think we want:

HTTP_TARGET_HOST : taken from the incoming request
HTTP_CONNECTION : not set
HTTP_PROXY_HOST : not set
HTTP_REQ_SENT : set to true once we know we're going to return a cached response (?)
HTTP_REQUEST : incoming request
HTTP_RESPONSE : set to the response generated by the cache

The only muddy part for me is what to do for a cache validation, where I have a stale entry but am sending a conditional request to validate. I think this is exactly as above, except:

HTTP_REQ_SENT : set by underlying client once conditional request has been sent
HTTP_REQUEST : validation request, set by underlying client
HTTP_RESPONSE : actual origin response (possibly a 304), set by underlying client

The other options for request/response are to use the incoming request to the cache and the validated cache response, but my inclination is that we should set these to the actual requests and responses issued to/from the origin server. However, I could see good arguments either way. Thoughts?

                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Updated] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Jon Moore (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore updated HTTPCLIENT-1198:
----------------------------------

          Component/s: Cache
    Affects Version/s: 4.1.3
        Fix Version/s: 4.2.1

Right, the CachingHttpClient relies on the "backend" client to fill these parts of the HttpContext out. When the CachingHttpClient serves a response out of cache, they don't get set, however. It should be possible to set some (but not all) of the usual HttpContext variables. For example, we can't set HTTP_CONNECTION or HTTP_PROXY_HOST on a cache hit.

                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Priority: Critical
>             Fix For: 4.2.1
>
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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


[jira] [Commented] (HTTPCLIENT-1198) HttpHost is not set in HttpContext in CachingHttpClient

Posted by "Jon Moore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13287630#comment-13287630 ] 

Jon Moore commented on HTTPCLIENT-1198:
---------------------------------------

One final comment here: for the cache validation case, all of the variables get set by the "backend" client (including HTTP_CONNECTION and HTTP_PROXY_HOST, if applicable) and the values are set to what is actually sent to and received from the origin.

                
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
>                 Key: HTTPCLIENT-1198
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Ilirjan Papa
>            Assignee: Jon Moore
>             Fix For: 4.2.1
>
>
> The HttpHost cames back as null, causing a NullPointerException when using CachingHttpClient.
> HttpHost actualHost = (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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