Blazemeter / jmeter-http2-plugin

HTTP2 plugin for Apache JMeter
Apache License 2.0
45 stars 27 forks source link

Client's cookie override is not properly checked by the bzm-http2 plugin #70

Open syampol13 opened 1 week ago

syampol13 commented 1 week ago

jmeter 5.6.2 bzm-http2: 2.0.5

Having a case where I need to rewrite cookie value in Jmeter. Do this via simple groovy/bsh code:

import org.apache.jmeter.protocol.http.control.CookieManager; import org.apache.jmeter.protocol.http.control.Cookie; CookieManager manager = sampler.getCookieManager();

for (int i=0; i<manager.getCookieCount(); i++){ if ( manager.get(i).getName().equals("SOME_NAME") ){ manager.remove(i);
} }

manager.add(new Cookie("SOME_NAME","NEW_VALUE","some_domain","/",true,0));

This works fine with the default http sample + cookie manager.

But with bzm-http2 plugin Cookie on server will have both values in this case (assuming there was a _set-cookie: SOMENAME=... before the above code executed). So server will have:

cookie: 'SOME_NAME=OLD_VALUE; SOME_NAME=NEW_VALUE; '

in this case.

This is because there are two cookie managers in case of bzm-http2 sample. The Jmeter's one and the Jetty's one. And the change made in the Jmeter's cookie manager is not reflected in the Jetty'e one. As an option this probably can be handled within the groovy/bsh as well. However this is not straight forward and I'm not sure the API is accessible from here.

As an option cookie existing in the Jetty's cookie manager could be removed in case they are present in the Jmeter's cookie manager. As Jmeter's one should have newer value. pr