You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Francois-Xavier Bonnet (JIRA)" <ji...@apache.org> on 2012/05/11 01:02:48 UTC

[jira] [Created] (HTTPCLIENT-1190) "Vary: Cookie" header not working

Francois-Xavier Bonnet created HTTPCLIENT-1190:
--------------------------------------------------

             Summary: "Vary: Cookie" header not working
                 Key: HTTPCLIENT-1190
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1190
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: Cache
    Affects Versions: 4.1.3, Snapshot
            Reporter: Francois-Xavier Bonnet


When using a CachingHttpClient with a target server that uses a cookie and "Vary: Cookie" header in order to have different variants depending on the value of the cookie, there is only one variant stored in the cache and sent whatever the value of the cookie.
The problems comes from the cookie header that does not really exist in the request, it is just created by the HttpClient while executing the request. As a result the variant key is always "{cookie=}".

--
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-1190) "Vary: Cookie" header not working

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

Oleg Kalnichevski updated HTTPCLIENT-1190:
------------------------------------------

    Fix Version/s: 4.3 Final
    
> "Vary: Cookie" header not working
> ---------------------------------
>
>                 Key: HTTPCLIENT-1190
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1190
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.3, Snapshot
>            Reporter: Francois-Xavier Bonnet
>             Fix For: 4.3 Final
>
>
> When using a CachingHttpClient with a target server that uses a cookie and "Vary: Cookie" header in order to have different variants depending on the value of the cookie, there is only one variant stored in the cache and sent whatever the value of the cookie.
> The problems comes from the cookie header that does not really exist in the request, it is just created by the HttpClient while executing the request. As a result the variant key is always "{cookie=}".

--
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-1190) "Vary: Cookie" header not working

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

Jon Moore commented on HTTPCLIENT-1190:
---------------------------------------

Yes, this is a similar problem to HTTPCLIENT-1164, where DefaultHttpClient makes changes to the requests that affect caching and which the cache never sees. I think the proper solution to this is to extract cookie handling into a decorator as well, so that the cache can be wired up in-between that decorator and the rest of the request-issuing machinery. We'll have to take a look at what the default behavior for DefaultHttpClient is with respect to cookie handling, so that we can preserve that behavior while allowing the cache to be wired in properly.

As a side note, using "Vary: Cookie" with a shared cache, while allowed by the spec, is generally frowned upon (many popular stand-alone caches will simply refuse to cache these responses at all). You may be better off setting "Cache-Control: private" and installing client-side caches further upstream, since that's really what you're trying to accomplish. Of course, if you don't have control over the origin, then nevermind. Regardless, this is still a bug that should get fixed.

                
> "Vary: Cookie" header not working
> ---------------------------------
>
>                 Key: HTTPCLIENT-1190
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1190
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.3, Snapshot
>            Reporter: Francois-Xavier Bonnet
>
> When using a CachingHttpClient with a target server that uses a cookie and "Vary: Cookie" header in order to have different variants depending on the value of the cookie, there is only one variant stored in the cache and sent whatever the value of the cookie.
> The problems comes from the cookie header that does not really exist in the request, it is just created by the HttpClient while executing the request. As a result the variant key is always "{cookie=}".

--
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-1190) "Vary: Cookie" header not working

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

Francois-Xavier Bonnet commented on HTTPCLIENT-1190:
----------------------------------------------------

I have seen that cookie header generation is done by org.apache.http.client.protocol.RequestAddCookies
I don't know what is the best way to make the changes to the request visible from the cache. Even if HttpClient made these changes visible once the request is executed, the problem is that we need these headers before to be able to lookup for the right variant key. Another problem is that HttpRequestInterceptors are using the HttpContext and currently CacheKeyGenerator does not know the HttpContext so we would have to make some big changes.

If you have some ideas about how we could design all that, I will be happy to try to make a patch. I can see a quick fix using RequestAddCookies inside CacheKeyGenerator but this would not be clean and it would work anly for Cookie header and we may have the same problem with other HttpRequestInterceptors.

About the use of "Vary: Cookie" the idea is not to store private contents inside a shared cache, it is more about being able to make some user profiles in your web site. Imagine that you have 1000 users and you can split them into 3 different profiles and you want each profile to see a different variant of the pages. If the cache is able to store the 3 variants and serve them to the right users depending on their cookie value it can improve a lot the performance.
                
> "Vary: Cookie" header not working
> ---------------------------------
>
>                 Key: HTTPCLIENT-1190
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1190
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.3, Snapshot
>            Reporter: Francois-Xavier Bonnet
>
> When using a CachingHttpClient with a target server that uses a cookie and "Vary: Cookie" header in order to have different variants depending on the value of the cookie, there is only one variant stored in the cache and sent whatever the value of the cookie.
> The problems comes from the cookie header that does not really exist in the request, it is just created by the HttpClient while executing the request. As a result the variant key is always "{cookie=}".

--
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