Cookies with empty values #198

skaurus opened this Issue Aug 15, 2011 · 2 comments


None yet

2 participants


If I set cookie with empty value, headers will look like this:

Set-Cookie: cookiename; Version=1;; Path=/; expires=Mon, 15 Aug 2011 17:14:39 GMT

This is not parsed by FF5, at least when there a other cookies. For example, Mojo can response with these headers:

Status=Found - 302
X-Powered-By=Mojolicious (Perl)
Set-Cookie=user_info=0; Version=1;; Path=/; expires=Thu, 23 Apr 2043 22:45:07 GMT
mrc; Version=1;; Path=/; expires=Mon, 15 Aug 2011 20:57:27 GMT
knot=eyJ2YWxpZF90byI6MCwibmFtZSI6IndyQjJBS201Nmw1TSIsInRlbXBfbmFtZSI6MSwiZXhwaXJlcyI6MTM0NDk3NzkwN30---504861f8bc8377f06d88fdf24babd9fe; Version=1;; Path=/; expires=Tue, 14 Aug 2012 20:58:27 GMT
Date=Mon, 15 Aug 2011 20:58:27 GMT

(tracked by Tamper Data), and cookies will be parsed this way: (as shown by Tamper Data too, also I set "ask me about every cookie" and I seen only user_info and knot cookies).

Changing line from

$cookie .= "=$value" if defined $value && length $value;


$cookie .= "=$value" if defined $value;

resolves this issue.

This looks like according with W3C spec, not sure about Netscape one.


Thanks, fixed. cc45268

@kraih kraih closed this Aug 15, 2011

Fantastic! Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment