Commit 0a9b45d8 authored by Geoff Simmons's avatar Geoff Simmons

Bugfix: in VCL set the backend in the "grace-hit" case.

Otherwise no backend is set for background fetches.
parent 33d04ce3
...@@ -733,10 +733,8 @@ func TestRewriteDeleteAuth(t *testing.T) { ...@@ -733,10 +733,8 @@ func TestRewriteDeleteAuth(t *testing.T) {
t.Fatal("WriteFile():", err) t.Fatal("WriteFile():", err)
} }
if !bytes.Equal(goldbytes, []byte(src)) { if !bytes.Equal(goldbytes, []byte(src)) {
t.Fatalf("Generated VCL does not match gold file: %s", gold) t.Fatalf("Generated VCL does not match gold file: %s\n%s", gold,
if testing.Verbose() { src)
t.Logf("Generated: %s", src)
}
} }
} }
......
...@@ -182,3 +182,10 @@ sub vcl_pass { ...@@ -182,3 +182,10 @@ sub vcl_pass {
sub vcl_pipe { sub vcl_pipe {
call vk8s_set_backend; call vk8s_set_backend;
} }
sub vcl_hit {
if (obj.ttl < 0s) {
# Set a backend for a background fetch.
call vk8s_set_backend;
}
}
...@@ -92,6 +92,13 @@ sub vcl_pass { ...@@ -92,6 +92,13 @@ sub vcl_pass {
sub vcl_pipe { sub vcl_pipe {
call vk8s_set_backend; call vk8s_set_backend;
} }
sub vcl_hit {
if (obj.ttl < 0s) {
# Set a backend for a background fetch.
call vk8s_set_backend;
}
}
sub vcl_deliver { sub vcl_deliver {
set resp.http.Hello = "world"; set resp.http.Hello = "world";
} }
\ No newline at end of file
...@@ -93,6 +93,13 @@ sub vcl_pipe { ...@@ -93,6 +93,13 @@ sub vcl_pipe {
call vk8s_set_backend; call vk8s_set_backend;
} }
sub vcl_hit {
if (obj.ttl < 0s) {
# Set a backend for a background fetch.
call vk8s_set_backend;
}
}
import std; import std;
import directors; import directors;
......
...@@ -92,3 +92,10 @@ sub vcl_pass { ...@@ -92,3 +92,10 @@ sub vcl_pass {
sub vcl_pipe { sub vcl_pipe {
call vk8s_set_backend; call vk8s_set_backend;
} }
sub vcl_hit {
if (obj.ttl < 0s) {
# Set a backend for a background fetch.
call vk8s_set_backend;
}
}
...@@ -34,6 +34,13 @@ sub vcl_pipe { ...@@ -34,6 +34,13 @@ sub vcl_pipe {
call vk8s_set_backend; call vk8s_set_backend;
} }
sub vcl_hit {
if (obj.ttl < 0s) {
# Set a backend for a background fetch.
call vk8s_set_backend;
}
}
import re2; import re2;
sub vcl_init { sub vcl_init {
......
...@@ -158,3 +158,10 @@ sub vcl_pass { ...@@ -158,3 +158,10 @@ sub vcl_pass {
sub vcl_pipe { sub vcl_pipe {
call vk8s_set_backend; call vk8s_set_backend;
} }
sub vcl_hit {
if (obj.ttl < 0s) {
# Set a backend for a background fetch.
call vk8s_set_backend;
}
}
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