You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by bu...@apache.org on 2007/03/18 18:35:25 UTC

DO NOT REPLY [Bug 28715] - User Parameters do not work in HTTP Cookie Manager

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28715>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28715





------- Additional Comments From alf@i100.no  2007-03-18 10:35 -------
I have been briefly looking at this.

The following short patch seems to make it possible to use functions and user
parameters in the CookieManager.

Index: C:/Documents and
Settings/alf/workspace/Jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
===================================================================
--- C:/Documents and
Settings/alf/workspace/Jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
(revision 519613)
+++ C:/Documents and
Settings/alf/workspace/Jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
(working copy)
@@ -290,7 +290,10 @@
         int i=0;
         for (PropertyIterator iter = getCookies().iterator(); iter.hasNext();) {
             Cookie jmcookie = (Cookie) iter.next().getObjectValue();
+            // Set to running version, to allow function evaluation for the
cookie values
+            jmcookie.setRunningVersion(true);
             cookies[i++] = makeCookie(jmcookie);
+            jmcookie.setRunningVersion(false);
         }
         String host = url.getHost();
         String protocol = url.getProtocol();


However, I'm not sure this is the correct way of fixing this.
I have not looked much at the CookieManager code.
Are there threading issues involved ? I.e. can different threads be accessing
the cookies at the same time ? In that case, the different threads can set and
unset the running version.
Or do each thread have it's own instance of the CookieManager and all other
ConfigTestElement ?
If each thread have their own CookieManager, I think the simple patch above is
correct.

Do we want to only allow variable expansion in the static cookies, and not in
the runtime cookies received during sampling ?

Perhaps Stephen Cooper's patch from 2005-10-10 looks better, but the code seems
to have changed a bit since his suggestion.

Could we just call "setRunningVersion(false); setRunningVersion(false);" on each
cookie as the first thing to do in "testIterationStart" ?
Or will we get threading issues here as well ?

And also call "setRunningVersion(false);" on each cookie on "testEnded" ?
Perhaps that is not needed, as it seems like the GUI recreates all the cookies
"static cookies" when you go to the CookieManager GUI. I'm at least unable to
figure out when all the dynamic cookies are deleted, but I never see them in the
GUI.

Or should we add a flag to the Cookie class, so we know which ones are static
and which ones are dynamic, and then loop over all the static ones in
the following methods in CookieManager :
public void recoverRunningVersion() 
public void setRunningVersion

I'm sorry for all the questions, but this bug seems like an "easy" one to fix,
and quite important.

Any comments ?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org