Skip to content

Commit 744bed5

Browse files
committed
we need stdlib.h for the reverse-proxy-ttl handling
1 parent 422458b commit 744bed5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Resources/doc/reference/configuration/headers.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ you need to extend your varnish ``vcl_fetch`` configuration:
336336

337337
.. code-block:: c
338338
339+
C{
340+
#include <stdlib.h>
341+
}C
342+
339343
sub vcl_fetch {
340344
if (beresp.http.X-Reverse-Proxy-TTL) {
341345
C{
@@ -347,6 +351,12 @@ you need to extend your varnish ``vcl_fetch`` configuration:
347351
}
348352
}
349353
354+
The import for ``stdlib.h`` has to be outside of any ``vcl_X`` sub routines.
355+
Omitting the ``stdlib`` inclusion will result in a compile error complaining
356+
that ``atoi`` is not defined, and including the header file inside a VCL sub
357+
routine leads to a C compile failure mentioning
358+
``invalid storage class for function __bswap_32``.
359+
350360
Note that there is a ``beresp.ttl`` field in VCL but unfortunately it can only
351361
be set to absolute values and not dynamically. Thus we have to revert to a C
352362
code fragment.

0 commit comments

Comments
 (0)