Skip to content

Instantly share code, notes, and snippets.

@nkallen
Created November 13, 2008 18:05
Show Gist options
  • Save nkallen/24538 to your computer and use it in GitHub Desktop.
Save nkallen/24538 to your computer and use it in GitHub Desktop.
test "Authorization tokens are cached"
server s {
rxreq
expect req.url == "/"
expect req.http.Authorization == "Basic foo"
txresp -status 200
rxreq
expect req.url == "/"
expect req.http.Authorization == "Basic bar"
txresp -status 404
} -start
varnish v -vcl+backend {
include "/usr/local/etc/varnish/default.vcl";
} -start
client c1 {
txreq -req GET -url "/" -hdr "Authorization: Basic foo"
rxresp
txreq -req GET -url "/" -hdr "Authorization: Basic foo"
rxresp
} -run
client c2 {
txreq -req GET -url "/" -hdr "Authorization: Basic bar"
rxresp
expect resp.status == 404
txreq -req GET -url "/" -hdr "Authorization: Basic bar"
rxresp
expect resp.status == 404
} -run
varnish v -expect cache_hit == 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment