Commit 58b2d306 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Grow a separator argument in std.collect

Fixes #2292
parent d26a8287
#-
# Copyright (c) 2010-2015 Varnish Software AS
# Copyright (c) 2010-2017 Varnish Software AS
# All rights reserved.
#
# Author: Poul-Henning Kamp <phk@FreeBSD.org>
......@@ -107,17 +107,19 @@ Description
Example
set beresp.http.served-by = std.fileread("/etc/hostname");
$Function VOID collect(HEADER hdr)
$Function VOID collect(HEADER hdr, STRING sep=",")
Description
Collapses multiple *hdr* headers into one long header.
The header values are joined with a comma (",").
The header values are joined with a comma (",") unless a
different separator is specified.
Care should be taken when collapsing headers. In particular
collapsing Set-Cookie will lead to unexpected results on the
browser side.
Example
std.collect(req.http.cookie);
Examples
std.collect(req.http.accept);
std.collect(req.http.cookie, "; ");
$Function DURATION duration(STRING s, DURATION fallback)
......
/*-
* Copyright (c) 2010-2015 Varnish Software AS
* Copyright (c) 2010-2017 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@FreeBSD.org>
......@@ -174,13 +174,13 @@ vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...)
}
VCL_VOID __match_proto__(td_std_collect)
vmod_collect(VRT_CTX, VCL_HEADER hdr)
vmod_collect(VRT_CTX, VCL_HEADER hdr, VCL_STRING sep)
{
struct http *hp;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
hp = VRT_selecthttp(ctx, hdr->where);
http_CollectHdr(hp, hdr->what);
http_CollectHdrSep(hp, hdr->what, sep);
}
VCL_BOOL __match_proto__(td_std_healthy)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment