[master] c4ec4712f vcl: Make resp.proto read-only

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Feb 1 16:31:08 UTC 2021


commit c4ec4712feb7615c6015272fb2b5d01069de4e8b
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Feb 1 17:19:20 2021 +0100

    vcl: Make resp.proto read-only
    
    One of the VCL 4.1 changes was to make the protocol read-only, which
    we've successfully done for all variables except resp.proto that
    kept the exact same definition for both 4.0 and 4.1 versions, despite
    having distinct definitions.

diff --git a/bin/varnishtest/tests/v00001.vtc b/bin/varnishtest/tests/v00001.vtc
index 0e9729d49..e31596934 100644
--- a/bin/varnishtest/tests/v00001.vtc
+++ b/bin/varnishtest/tests/v00001.vtc
@@ -1,5 +1,20 @@
 varnishtest "VCL/VRT: url/request/proto/reason/status"
 
+varnish v1 -errvcl "Variable is read only" {
+	sub vcl_deliver { set req.proto = "HTTP/1.2"; }
+}
+
+varnish v1 -errvcl "Variable is read only" {
+	sub vcl_deliver { set resp.proto = "HTTP/1.2"; }
+}
+
+varnish v1 -errvcl "Variable is read only" {
+	sub vcl_backend_response { set bereq.proto = "HTTP/1.2"; }
+}
+
+varnish v1 -errvcl "Variable is read only" {
+	sub vcl_backend_response { set beresp.proto = "HTTP/1.2"; }
+}
 
 server s1 {
 	rxreq
diff --git a/doc/sphinx/reference/vcl_var.rst b/doc/sphinx/reference/vcl_var.rst
index c9fa94df9..fc0d76ef5 100644
--- a/doc/sphinx/reference/vcl_var.rst
+++ b/doc/sphinx/reference/vcl_var.rst
@@ -1191,8 +1191,6 @@ resp.proto	``VCL >= 4.1``
 
 	Readable from: vcl_deliver, vcl_synth
 
-	Writable from: vcl_deliver, vcl_synth
-
 	The HTTP protocol version to use for the response.
 
 resp.status


More information about the varnish-commit mailing list