Bug 47461 - Update Cache Manager to handle Expires HTTP header
Summary: Update Cache Manager to handle Expires HTTP header
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-30 12:55 UTC by Chris C.
Modified: 2012-07-09 15:02 UTC (History)
0 users



Attachments
diff of code implementing feature (8.44 KB, patch)
2009-06-30 12:55 UTC, Chris C.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris C. 2009-06-30 12:55:10 UTC
Created attachment 23915 [details]
diff of code implementing feature

This is an enhancement to the Cache Manager which can be included in HTTP test plans to support cache logic based on the HTTP Expires header.  

When a web browser receives a response with a future expires header, it may safely reuse that cached response until the expiration date without making any request to the server.  

The HTTP specification allows for dates up to one year in the future, but in practice many websites use dates very far in the future.  This technique is described at http://www.askapache.com/htaccess/apache-speed-expires.html.  For the purposes of this feature, how far in the future the content expires is not relevant.

The attached diff implements logic to simulate browser behavior.  When a cacheable response is received, the expiration date is remembered.  Subsequent requests for the same URL will check the cache and short circuit the request if a valid (not yet expired) response is available in the cache.

This is my first attempt at JMeter code and I'm sure this could be improved by someone more familiar with the project.
Comment 1 Sebb 2009-11-16 16:20:28 UTC
Tnanks for the patch, applied:



I changed the code a bit:
- use DateUtils from HttpClient 3.1 to parse the Expiry date
- parse the Expiry date once rather than each time
- made the new behaviour optional
- only apply the Expires checking to GET requests
- apply the processing to the HttpClient sampler as well
Comment 2 Sebb 2012-07-09 15:02:25 UTC
For info:

URL: http://svn.apache.org/viewvc?rev=881068&view=rev
Log:
Bug 47461 - Update Cache Manager to handle Expires HTTP header

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CacheManagerGui.java
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Comment 3 The ASF infrastructure team 2022-09-24 20:37:43 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2254