Author: pmouawad
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
Modified: jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1623460&r1=1623459&r2=1623460&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.properties (original)
+++ jmeter/trunk/bin/jmeter.properties Mon Sep 8 18:59:01 2014
@@ -415,6 +415,12 @@ log_level.jorphan=INFO
#cacheable_methods=GET
# N.B. This property is currently a temporary solution for Bug 56162
+# Since 2.12, JMeter does not create anymore a Sample Result for a resource
+# found in cache which is inline with what browser do
+# If you need to revert to previous behaviour, you can set this property
+# to true
+#cache_manager.return_204_for_cached_resource=false
+
#---------------------------------------------------------------------------
# Results file configuration
#---------------------------------------------------------------------------
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java?rev=1623460&r1=1623459&r2=1623460&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
Mon Sep 8 18:59:01 2014
@@ -40,12 +40,19 @@ import org.apache.jmeter.protocol.http.u
import org.apache.jmeter.protocol.http.util.HTTPFileArg;
import org.apache.jmeter.samplers.Interruptible;
import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.util.JMeterUtils;
/**
* Base class for HTTP implementations used by the HTTPSamplerProxy sampler.
*/
public abstract class HTTPAbstractImpl implements Interruptible, HTTPConstantsInterface {
+ /**
+ * If true create a SampleResult with emply content and 204 response code
+ */
+ private static final boolean RETURN_204_FOR_INCACHE_RESOURCE =
+ JMeterUtils.getPropDefault("cache_manager.return_204_for_cached_resource", false);
+
protected final HTTPSamplerBase testElement;
protected HTTPAbstractImpl(HTTPSamplerBase testElement){
@@ -328,13 +335,14 @@ public abstract class HTTPAbstractImpl i
* @return HTTPSampleResult
*/
protected HTTPSampleResult updateSampleResultForResourceInCache(HTTPSampleResult res)
{
- // TODO Should we add an option to keep compatibility
-// res.sampleEnd();
-// res.setResponseNoContent();
-// res.setSuccessful(true);
-// return res;
- // We don't want to issue a SampleResult
- // see https://issues.apache.org/bugzilla/show_bug.cgi?id=54778
- return null;
+ if(!RETURN_204_FOR_INCACHE_RESOURCE) {
+ // We don't want to issue a SampleResult
+ // see https://issues.apache.org/bugzilla/show_bug.cgi?id=54778
+ return null;
+ }
+ res.sampleEnd();
+ res.setResponseNoContent();
+ res.setSuccessful(true);
+ return res;
}
}
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1623460&r1=1623459&r2=1623460&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Mon Sep 8 18:59:01 2014
@@ -125,7 +125,8 @@ jmeter.gui.action.LookAndFeelCommand: Us
<ul>
<li>Since JMeter 2.12, Mail Reader Sampler will show 1 for number of samples instead
of number of messages retrieved, see <bugzilla>56539</bugzilla></li>
-<li>Since JMeter 2.12, when using Cache Manager, if resource is found in cache no SampleResult
will be created, in previous version a SampleResult with empty content and 204 return code
was returned, see <bugzilla>54778</bugzilla>.</li>
+<li>Since JMeter 2.12, when using Cache Manager, if resource is found in cache no SampleResult
will be created, in previous version a SampleResult with empty content and 204 return code
was returned, see <bugzilla>54778</bugzilla>.
+To revert to old behaviour, set property "cache_manager.return_204_for_cached_resource" to
true.</li>
<li>Since JMeter 2.12, Log Viewer will no more clear logs when closed and will have
logs available even if closed. See <bugzilla>56920</bugzilla>. Read <a href="./usermanual/hints_and_tips.html#debug_logging">Hints
and Tips > Enabling Debug logging</a>
for details on configuring this component.</li>
</ul>
|