[4.1] 0dffa87 Fix loading of cold VCLs
Poul-Henning Kamp
phk at FreeBSD.org
Fri Sep 4 15:54:55 CEST 2015
commit 0dffa87db4bf9d449781d244a00745a23a02803d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Aug 17 09:25:19 2015 +0000
Fix loading of cold VCLs
Fixes: #1775
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index e11cf01..9c7ee4a 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -398,6 +398,10 @@ vcl_set_state(struct vcl *vcl, const char *state)
case '0':
if (vcl->temp == vcl_temp_cold)
break;
+ if (vcl->temp == vcl_temp_init) {
+ vcl->temp = vcl_temp_cold;
+ break;
+ }
if (vcl->busy == 0) {
vcl->temp = vcl_temp_cold;
(void)vcl->conf->event_vcl(&ctx, VCL_EVENT_COLD);
diff --git a/bin/varnishtest/tests/r01775.vtc b/bin/varnishtest/tests/r01775.vtc
new file mode 100644
index 0000000..5241b78
--- /dev/null
+++ b/bin/varnishtest/tests/r01775.vtc
@@ -0,0 +1,12 @@
+varnishtest "Test loading a VCL in cold state"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+
+} -start
+
+varnish v1 -cliok {vcl.inline vcl2 "vcl 4.0; backend b { .host = \":80\";}" cold}
More information about the varnish-commit
mailing list