Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add all headers from a req or bereq object (#33)
- Loading branch information
Reza Naghibi
committed
Feb 29, 2016
1 parent
86402b7
commit c52d777
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
varnishtest "Test header_add_all" | ||
|
||
server s1 { | ||
rxreq | ||
expect req.http.foo == "bar" | ||
expect req.http.be == "0" | ||
txresp | ||
accept | ||
rxreq | ||
expect req.http.foobe == "barbe" | ||
expect req.http.be == "2" | ||
txresp | ||
} -start | ||
|
||
varnish v1 -vcl+backend { | ||
import curl from "${vmod_topbuild}/src/.libs/libvmod_curl.so"; | ||
sub vcl_recv { | ||
if (req.http.be == "0") { | ||
curl.header_add_all(); | ||
curl.get("http://${s1_addr}:${s1_port}/"); | ||
return (synth(200)); | ||
} | ||
|
||
set req.http.be = "2"; | ||
} | ||
|
||
sub vcl_backend_fetch { | ||
set bereq.http.foobe = "barbe"; | ||
curl.header_add_all(); | ||
curl.get("http://${s1_addr}:${s1_port}/"); | ||
return (abandon); | ||
} | ||
} -start | ||
|
||
client c1 { | ||
txreq -url "/" -hdr "be: 0" -hdr "foo: bar" | ||
rxresp | ||
} -run | ||
|
||
client c2 { | ||
txreq -url "/" -hdr "be: 1" | ||
rxresp | ||
} -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters