Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache, make it configurable with new property cache_manager.cached_resource_mode
Summary: HTTP Sampler should not return 204 when resource is found in Cache, make it c...
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.9
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-31 19:40 UTC by Philippe Mouawad
Modified: 2014-09-14 14:04 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2013-03-31 19:40:41 UTC
Looking at Http implementations, it seems when Cache Manager is used and if URL was cached jmeter returns response code 204.

Looking at this code definition, it does not seem to be a good response no ?

---------------------------------------------------------------------------

The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response MAY include new or updated metainformation in the form of entity-headers, which if present SHOULD be associated with the requested variant.

If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view.

The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.
---------------------------------------------------------------------------
Comment 1 Philippe Mouawad 2014-08-30 14:19:16 UTC
Date: Sat Aug 30 14:18:24 2014
New Revision: 1621461

URL: http://svn.apache.org/r1621461
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache
Factor out common code
Bugzilla Id: 54778

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
Comment 2 Philippe Mouawad 2014-08-30 19:18:16 UTC
Date: Sat Aug 30 19:12:43 2014
New Revision: 1621523

URL: http://svn.apache.org/r1621523
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache
Bugzilla Id: 54778

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml

Date: Sat Aug 30 19:15:53 2014
New Revision: 1621524

URL: http://svn.apache.org/r1621524
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache
Bugzilla Id: 54778

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
Comment 3 Philippe Mouawad 2014-09-08 19:00:00 UTC
Date: Mon Sep  8 18:59:01 2014
New Revision: 1623460

URL: http://svn.apache.org/r1623460
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache
Add property to enable revert to previous behaviour
Bugzilla Id: 54778

Modified:
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
    jmeter/trunk/xdocs/changes.xml
Comment 4 Philippe Mouawad 2014-09-14 13:56:28 UTC
As per http://mail-archives.apache.org/mod_mbox/jmeter-dev/201409.mbox/%3CCAH9fUpZGrOhLZawoir4WrUFLiuJg3ZrRVJ4mpVxxS%2BahmcKQeQ%40mail.gmail.com%3E

Added 
cache_manager.cached_resource_mode=RETURN_NO_SAMPLE

You can choose between 3 modes:
1/RETURN_NO_SAMPLE (default)
2/RETURN_200_CACHE
3/RETURN_CUSTOM_STATUS

Those mode have the following behaviours:
RETURN_NO_SAMPLE : this mode returns no Sample Result, it has no additional configuration
RETURN_200_CACHE : this mode will return Sample Result with response code to 200 and response message to "(ex cache)", you can modify response message by setting RETURN_200_CACHE.message=(ex cache)
RETURN_CUSTOM_STATUS : This mode lets you select what response code and message you want to return, if you use this mode you need to set those properties
RETURN_CUSTOM_STATUS.code=
RETURN_CUSTOM_STATUS.message=
Comment 5 Philippe Mouawad 2014-09-14 14:04:22 UTC
Date: Sun Sep 14 13:58:53 2014
New Revision: 1624849

URL: http://svn.apache.org/r1624849
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache, make it configurable with new property cache_manager.cached_resource_mode

Implemented as per dev mailing list discussion http://mail-archives.apache.org/mod_mbox/jmeter-dev/201409.mbox/%3CCAH9fUpZGrOhLZawoir4WrUFLiuJg3ZrRVJ4mpVxxS%2BahmcKQeQ%40mail.gmail.com%3E

Bugzilla Id: 54778

Modified:
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
    jmeter/trunk/xdocs/changes.xml