Mailing List Archive

[6.0] a15a5fcb6 Centralize the VCL status code documentation
commit a15a5fcb6ec379a3d54eedc412d97a1bdfb6bdcf
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date: Tue May 12 09:03:38 2020 +0200

Centralize the VCL status code documentation

Conflicts:
doc/sphinx/reference/vcl_var.rst

diff --git a/doc/sphinx/reference/vcl_var.rst b/doc/sphinx/reference/vcl_var.rst
index 99c114f39..55b0defca 100644
--- a/doc/sphinx/reference/vcl_var.rst
+++ b/doc/sphinx/reference/vcl_var.rst
@@ -702,13 +702,7 @@ beresp.status

The HTTP status code returned by the server.

- Status codes on the form XXYZZ can be set where
- XXYZZ is less than 65536 and Y is [1...9].
- Only YZZ will be sent back to clients.
-
- XX can be therefore be used to pass information
- around inside VCL, for instance `return(synth(22404))`
- from `vcl_recv{}` to `vcl_synth{}`
+ More information in the `HTTP response status`_ section.

beresp.reason

@@ -953,6 +947,8 @@ obj.status

The HTTP status code stored in the object.

+ More information in the `HTTP response status`_ section.
+

obj.reason

@@ -1096,12 +1092,7 @@ resp.status

The HTTP status code that will be returned.

- Assigning a HTTP standardized code to resp.status will also
- set resp.reason to the corresponding status message.
-
- Status codes on the form XXYZZ can be set where
- XXYZZ is less than 65536 and Y is [1...9].
- Only YZZ will be sent back to clients.
+ More information in the `HTTP response status`_ section.

resp.status 200 will get changed into 304 by core code after
a return(deliver) from vcl_deliver for conditional requests
@@ -1235,3 +1226,29 @@ storage.<name>.happy
Health status for the named stevedore. Not available in any of the
current stevedores.

+HTTP response status
+--------------------
+
+A status code normally has 3 digits XYZ where X must be between 1 and 5
+included. Since it is not uncommon to see HTTP clients or servers relying
+on non-standard or even invalid status codes Varnish tolerates any status
+between 100 and 999.
+
+With VCL code it is possible to use status codes in the form XXYZZ where the
+overall value is lower than 65536 and the Y digit is between 1 and 9 included.
+Only the YZZ part is sent to the client.
+
+The XXYZZ form of status codes can be set on ``resp.status`` and
+``beresp.status`` or passed via ``return(synth(...))`` and
+``return(error(...))`` transitions.
+
+XX can be therefore be used to pass information around inside VCL, for
+instance ``return(synth(22404))`` from ``vcl_recv{}`` to ``vcl_synth{}``.
+
+The ``obj.status`` variable will inherit the XXYZZ form, but in a ban
+expresion only the YZZ part will be available. The XXYZZ form is strictly
+limited to VCL execution.
+
+Assigning an HTTP standardized code to ``resp.status`` or ``beresp.status``
+will also set ``resp.reason`` or ``beresp.reason`` to the corresponding
+status message.
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit