Author: sebb
Date: Mon Nov 3 08:09:20 2008
New Revision: 710091
URL: http://svn.apache.org/viewvc?rev=710091&view=rev
Log:
Cookie Manager no longer stores cookies by default
Modified:
jakarta/jmeter/trunk/bin/jmeter.properties
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified: jakarta/jmeter/trunk/bin/jmeter.properties
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/jmeter.properties?rev=710091&r1=710090&r2=710091&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/jmeter.properties (original)
+++ jakarta/jmeter/trunk/bin/jmeter.properties Mon Nov 3 08:09:20 2008
@@ -602,6 +602,14 @@
# Default is true. Use false to revert to original behaviour
#CookieManager.allow_variable_cookies=true
+# CookieManager behaviour - should Cookies be stored as variables?
+# Default is false
+#CookieManager.save.cookies=false
+
+# CookieManager behaviour - prefix to add to cookie name before storing it as
a variable
+# Default is COOKIE_; to remove the prefix, define it as one or more spaces
+#CookieManager.name.prefix=
+
# (2.0.3) JMeterThread behaviour has been changed to set the started flag
before
# the controllers are initialised. This is so controllers can access variables
earlier.
# In case this causes problems, the previous behaviour can be restored by
uncommenting
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java?rev=710091&r1=710090&r2=710091&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
Mon Nov 3 08:09:20 2008
@@ -70,13 +70,19 @@
private static final String TAB = "\t"; //$NON-NLS-1$
// See bug 33796
- private static final boolean DELETE_NULL_COOKIES
- = JMeterUtils.getPropDefault("CookieManager.delete_null_cookies",
true);// $NON-NLS-1$
+ private static final boolean DELETE_NULL_COOKIES =
+ JMeterUtils.getPropDefault("CookieManager.delete_null_cookies",
true);// $NON-NLS-1$
// See bug 28715
private static final boolean ALLOW_VARIABLE_COOKIES
= JMeterUtils.getPropDefault("CookieManager.allow_variable_cookies",
true);// $NON-NLS-1$
+ private static final String COOKIE_NAME_PREFIX =
+ JMeterUtils.getPropDefault("CookieManager.name.prefix",
"COOKIE_").trim();// $NON-NLS-1$ $NON-NLS-2$
+
+ private static final boolean SAVE_COOKIES =
+ JMeterUtils.getPropDefault("CookieManager.save.cookies", false);//
$NON-NLS-1$
+
private transient CookieSpec cookieSpec;
private transient CollectionProperty initialCookies;
@@ -242,12 +248,11 @@
log.debug("Add cookie to store " + c.toString());
}
getCookies().addItem(c);
- // Store cookie as a thread variable.
- // TODO - should we add a prefix to these variables?
- // TODO - should storing cookie values be optional?
- JMeterContext context = getThreadContext();
- if (context.isSamplingStarted()) {
- context.getVariables().put(cn, cv);
+ if (SAVE_COOKIES) {
+ JMeterContext context = getThreadContext();
+ if (context.isSamplingStarted()) {
+ context.getVariables().put(COOKIE_NAME_PREFIX+cn, cv);
+ }
}
}
}
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=710091&r1=710090&r2=710091&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Mon Nov 3 08:09:20 2008
@@ -72,6 +72,12 @@
They were previously shown as Post-Processors, even though they are
implemented as Listeners.
</p>
<p>
+The Cookie Manager no longer saves incoming cookies as variables by default.
+To save cookies as variables, define the property
"CookieManager.save.cookies=true".
+Also, cookies names are prefixed with "COOKIE_" before they are stored (this
avoids accidental corruption of local variables)
+To revert to the original behaviour, define the property
"CookieManager.name.prefix= " (one or more spaces).
+</p>
+<p>
The Counter element is now shown as a Configuration element.
It was previously shown as a Pre-Processor, even though it is implemented as a
Config item.
</p>
Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=710091&r1=710090&r2=710091&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Mon Nov 3
08:09:20 2008
@@ -2542,8 +2542,14 @@
use it for all future requests to that particular web site. Each JMeter
thread has its own
"cookie storage area". So, if you are testing a web site that uses a cookie
for storing
session information, each JMeter thread will have its own session.</p>
-<p>Received Cookies are stored as JMeter thread variables.
-Thus the value of a cookie with the name TEST can be referred to as ${TEST}</p>
+<p>
+Received Cookies can be stored as JMeter thread variables
+(versions of JMeter after 2.3.2 no longer do this by default).
+To save cookies as variables, define the property
"CookieManager.save.cookies=true".
+Also, cookies names are prefixed with "COOKIE_" before they are stored (this
avoids accidental corruption of local variables)
+To revert to the original behaviour, define the property
"CookieManager.name.prefix= " (one or more spaces).
+If enabled, the value of a cookie with the name TEST can be referred to as
${COOKIE_TEST}.
+</p>
<p>Second, you can manually add a cookie to the Cookie Manager. However, if
you do this,
the cookie will be shared by all JMeter threads.</p>
<p>Note that such Cookies are created with an Expiration time far in the
future</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]