Bug 58079 - HTTP Cache Manager doesn't respect Vary Header contract
Summary: HTTP Cache Manager doesn't respect Vary Header contract
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.13
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2015-06-26 13:49 UTC by Gilles Scokart
Modified: 2015-07-12 16:29 UTC (History)
1 user (show)



Attachments
Do not cache responses with Vary header (8.01 KB, patch)
2015-07-02 18:36 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gilles Scokart 2015-06-26 13:49:30 UTC
When we perform multiple HTTP request to the same URL but with different headers, the client must cache the response according to the value of the 'Vary' header in the response.

Currently, I have the impression it is not the case.

I have make a scenario with 2 HTTP Request, one with a header 'Accept : application/json' and the other with the header 'text/plain' (and my server set the header 'Vary' to 'Accept', and the header 'Cache-Control' to 'no-transform, max-age=86400').  

When caching is activated, I see only one of the 2 request in the aggregated graph results.
Comment 1 Felix Schumacher 2015-07-02 18:36:13 UTC
Created attachment 32881 [details]
Do not cache responses with Vary header

As a simple countermeasure to the described problem we could forbid to store http respones that have a Vary header with any value in it.

A more complex solution would have to cache multiple responses for one url depending on the request headers. I think we should start with the simple version and implement the complex one on demand only.
Comment 2 Philippe Mouawad 2015-07-04 13:15:50 UTC
+1 for me
Comment 3 Felix Schumacher 2015-07-12 16:29:57 UTC
Date: Sun Jul 12 16:25:08 2015
New Revision: 1690478

URL: http://svn.apache.org/r1690478
Log:
Do not cache http samples that have a Vary header.

Bugzilla Id: 58079

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml