Skip to content

Commit

Permalink
Clean up extra request headers after a fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Tollef Fog Heen authored and tfheen committed Apr 29, 2013
1 parent 3e8d8a1 commit 2a4ec58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/tests/test06.vtc
Expand Up @@ -4,12 +4,21 @@ server s1 {
rxreq
expect req.http.foo == "bar"
txresp
accept
rxreq
expect req.http.extra == "1"
expect req.http.foo != "bar"
txresp
} -start

varnish v1 -vcl+backend {
import curl from "${vmod_topbuild}/src/.libs/libvmod_curl.so";
sub vcl_recv {
curl.header_add("foo: bar");
if (req.http.extra) {
curl.header_add("extra: 1");
} else {
curl.header_add("foo: bar");
}
curl.get("http://${s1_addr}:${s1_port}");
error 200;
}
Expand All @@ -18,6 +27,9 @@ varnish v1 -vcl+backend {
client c1 {
txreq -url "/"
rxresp
}
} -run

client c1 -run
client c2 {
txreq -url "/" -hdr "Extra: 1"
rxresp
} -run
1 change: 1 addition & 0 deletions src/vmod_curl.c
Expand Up @@ -279,6 +279,7 @@ void vmod_get(struct sess *sp, const char *url)

if (req_headers)
curl_slist_free_all(req_headers);
cm_clear_req_headers(c);
curl_easy_cleanup(curl_handle);
}

Expand Down

0 comments on commit 2a4ec58

Please sign in to comment.