Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
6a9302c9
Commit
6a9302c9
authored
Feb 19, 2013
by
Dag Haavi Finstad
Committed by
Tollef Fog Heen
Feb 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make std.collect() also work for resp.http and bereq.http.
Fixes: #1222
parent
4e1fbb6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
m00006.vtc
bin/varnishtest/tests/m00006.vtc
+16
-0
vmod_std.c
lib/libvmod_std/vmod_std.c
+10
-1
No files found.
bin/varnishtest/tests/m00006.vtc
View file @
6a9302c9
...
...
@@ -6,6 +6,10 @@ server s1 {
expect req.http.foo == "1, 2"
txresp -hdr "bar: a" -hdr "bar: b" -bodylen 1
rxreq
expect req.url == "/2"
expect req.http.baz == "1, 2"
txresp -hdr "qux: a" -hdr "qux: b" -bodylen 1
} -start
varnish v1 -vcl+backend {
...
...
@@ -14,9 +18,15 @@ varnish v1 -vcl+backend {
sub vcl_recv {
std.collect(req.http.foo);
}
sub vcl_miss {
std.collect(bereq.http.baz);
}
sub vcl_fetch {
std.collect(beresp.http.bar);
}
sub vcl_deliver {
std.collect(resp.http.qux);
}
} -start
client c1 {
...
...
@@ -25,6 +35,12 @@ client c1 {
expect resp.http.bar == "a, b"
expect resp.status == 200
expect resp.bodylen == 1
txreq -url "/2" -hdr "Baz: 1" -hdr "Baz: 2"
rxresp
expect resp.http.qux == "a, b"
expect resp.status == 200
expect resp.bodylen == 1
} -run
varnish v1 -errvcl {'beresp.http.bar': Not available in method 'vcl_recv'} {
...
...
lib/libvmod_std/vmod_std.c
View file @
6a9302c9
...
...
@@ -175,6 +175,15 @@ vmod_collect(struct req *req, const struct gethdr_s *hdr)
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
if
(
hdr
->
where
==
HDR_REQ
)
http_CollectHdr
(
req
->
http
,
hdr
->
what
);
else
if
(
hdr
->
where
==
HDR_BERESP
&&
req
->
busyobj
!=
NULL
)
else
if
(
hdr
->
where
==
HDR_BEREQ
)
{
AN
(
req
->
busyobj
);
http_CollectHdr
(
req
->
busyobj
->
bereq
,
hdr
->
what
);
}
else
if
(
hdr
->
where
==
HDR_BERESP
)
{
AN
(
req
->
busyobj
);
http_CollectHdr
(
req
->
busyobj
->
beresp
,
hdr
->
what
);
}
else
if
(
hdr
->
where
==
HDR_RESP
)
{
http_CollectHdr
(
req
->
resp
,
hdr
->
what
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment