Bug 53336 - Cookie Manager will not handle cookies with a blank values
Summary: Cookie Manager will not handle cookies with a blank values
Status: RESOLVED WORKSFORME
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.7
Hardware: Macintosh All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on: 33796
Blocks:
  Show dependency tree
 
Reported: 2012-05-31 15:28 UTC by oliver lloyd
Modified: 2012-06-01 21:19 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oliver lloyd 2012-05-31 15:28:07 UTC
The HTTP Cookie Manager will not parse the response:

Set-Cookie: myCookieName=;

A browser will parse this and include the cookie 'myCookieName=;' in subsequent requests. Normally, this would not be a problem but this diversion in behavior (between JMeter and Browsers) actually caused me a few hours of confusion and I think that the correct logic would be to mimic browser behavior and send the cookie, even when it has no value.

In addition. If I try to force a cookie with a blank value by adding the cookie to the HTTP Cookie Manager manually, this fails; when clicking away from the control the entry is not saved.
Comment 1 Philippe Mouawad 2012-05-31 21:18:59 UTC
Hello,
Is the behaviour with 2.6 the same ?
Did you try all cookie policies and if not which one is failing ?

Thanks
Regards
Comment 2 oliver lloyd 2012-06-01 08:05:06 UTC
Yes, same with 2.6 and yes, it's the same no matter which policy I tried.
Comment 3 Philippe Mouawad 2012-06-01 11:56:16 UTC
Hi,
Can you attach a screenshot of what you tried regarding this:
"If I try to force a cookie with a blank value by adding the cookie to the HTTP Cookie Manager manually, this fails; when clicking away from the control the entry is not saved." ?

Thanks
Regards
Philippe
Comment 4 oliver lloyd 2012-06-01 12:02:36 UTC
Not sure a screenshot would capture the problem - it is the absence of something that is the issue! Maybe I can explain it better though.

Essentially, the problem is that if I add a user-defined cookie without anything in the value field, then it is simply not saved. As soon as you click away from the HTTP Cookie Manager and return, the entry that was entered is gone.

Steps to reproduce:

1. Add a HTTP Cookie Manager.
2. At the bottom of the form, Click Add.
3. Enter a name for the cookie.
4. Click away from the control and then click again on the Cookie Manager.

The cookie previously entered is no longer present.
Comment 5 Philippe Mouawad 2012-06-01 21:06:40 UTC
Hello Oliver,
Regarding the issue you detailed in last comment, see bug 33796.
This can be controlled by:
CookieManager.delete_null_cookies=false

Settting this value will not remove cookie.

So I will close issue as worksforme, reopen it if you think it's wrong.
Comment 6 oliver lloyd 2012-06-01 21:19:13 UTC
Ah ha! OK, yes, I can confirm this is the case.

One comment though, to mimic the default behavior for Chrome (and I'm pretty sure all other browsers) would it be better to have this setting default to false, instead of true?
Comment 7 The ASF infrastructure team 2022-09-24 20:37:50 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2838