[master] 1a3b50580 vmod_cookie: Name and value are separated by equal sign
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Mar 21 16:19:05 UTC 2022
commit 1a3b50580da6f81977ecdfc41fc053d0cacfd718
Author: Jesús Martínez Novo <martineznovo at gmail.com>
Date: Mon Dec 13 23:45:06 2021 +0100
vmod_cookie: Name and value are separated by equal sign
Cookie name and value are separated by equal sign, not colon.
Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
I adjusted the docs to reflect the removal of spurious trailing
semi-colon from the generated cookie string.
Closes #3754
diff --git a/vmod/vmod_cookie.vcc b/vmod/vmod_cookie.vcc
index e92e11e5e..69f167d02 100644
--- a/vmod/vmod_cookie.vcc
+++ b/vmod/vmod_cookie.vcc
@@ -67,9 +67,9 @@ Delete ``cookiename`` from internal vmod storage if it exists.
Example::
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2;");
+ cookie.parse("cookie1=value1; cookie2=value2");
cookie.delete("cookie2");
- # get_string() will now yield "cookie1: value1";
+ # get_string() will now yield "cookie1=value1"
}
$Function VOID filter(PRIV_TASK, STRING filterstring)
@@ -80,10 +80,9 @@ comma-separated argument cookienames.
Example::
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2; cookie3: value3");
+ cookie.parse("cookie1=value1; cookie2=value2; cookie3=value3");
cookie.filter("cookie1,cookie2");
- # get_string() will now yield
- # "cookie3: value3";
+ # get_string() will now yield "cookie3=value3"
}
@@ -95,10 +94,9 @@ regular expression ``expression``.
Example::
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2; cookie3: value3");
+ cookie.parse("cookie1=value1; cookie2=value2; cookie3=value3");
cookie.filter_re("^cookie[12]$");
- # get_string() will now yield
- # "cookie3: value3";
+ # get_string() will now yield "cookie3=value3"
}
$Function VOID keep(PRIV_TASK, STRING filterstring)
@@ -109,10 +107,9 @@ comma-separated argument cookienames.
Example::
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2; cookie3: value3");
+ cookie.parse("cookie1=value1; cookie2=value2; cookie3=value3");
cookie.keep("cookie1,cookie2");
- # get_string() will now yield
- # "cookie1: value1; cookie2: value2;";
+ # get_string() will now yield "cookie1=value1; cookie2=value2"
}
$Function VOID keep_re(PRIV_TASK, REGEX expression)
@@ -123,10 +120,9 @@ expression ``expression``.
Example::
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2; cookie3: value3");
+ cookie.parse("cookie1=value1; cookie2=value2; cookie3=value3");
cookie.keep_re("^cookie[12]$");
- # get_string() will now yield
- # "cookie1: value1; cookie2: value2;";
+ # get_string() will now yield "cookie1=value1; cookie2=value2"
}
@@ -156,7 +152,7 @@ Example::
import std;
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2;");
+ cookie.parse("cookie1=value1; cookie2=value2");
std.log("cookie1 value is: " + cookie.get("cookie1"));
}
@@ -202,7 +198,7 @@ Example::
import std;
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2;");
+ cookie.parse("cookie1=value1; cookie2=value2");
std.log("cookie1 value is: " + cookie.get_re("^cookie1$"));
}
@@ -227,7 +223,7 @@ Example::
import std;
sub vcl_recv {
- cookie.parse("cookie1: value1; cookie2: value2;");
+ cookie.parse("cookie1=value1; cookie2=value2");
if (cookie.isset("cookie2")) {
std.log("cookie2 is set.");
}
More information about the varnish-commit
mailing list