-
Notifications
You must be signed in to change notification settings - Fork 404
Closed
Description
Expected Behavior
cookie.get() should return an empty string if no such cookie was present in the request header, as documented
Current Behavior
On Varnish 6.6.0, cookie.get() returns something other than an empty string/empty value.
Steps to Reproduce (for bugs)
Simple varnishtest reproducer:
varnishtest "cookie.get() with nonexistent cookie"
server s1 {
rxreq
expect req.http.X-Cookie-Present == "0"
txresp
} -start
varnish v1 -vcl+backend {
vcl 4.1;
import cookie;
sub vcl_recv {
if (req.http.Cookie) {
cookie.parse(req.http.Cookie);
if (cookie.get("no_such_cookie") != "") {
set req.http.X-Cookie-Present = "1";
} else {
set req.http.X-Cookie-Present = "0";
}
}
return(pass);
}
} -start
client c1 {
txreq -hdr "Cookie: some_cookie=foo;other_cookie=bar"
rxresp
} -run
The above test also fails if the condition is changed to if (!cookie.get("no_such_cookie")). cookie.isset() however works as expected.
Context
I wanted to use cookie.get("no_such_cookie") != "" to handle both the case where the cookie is not set, or where it's set but the value is empty.
Your Environment
- Version used: 6.6.0
- Operating System and version: Debian Buster
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels