Skip to content

we need stdlib.h for the reverse-proxy-ttl handling #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Resources/doc/reference/configuration/headers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ you need to extend your varnish ``vcl_fetch`` configuration:

.. code-block:: c

C{
#include <stdlib.h>
}C

sub vcl_fetch {
if (beresp.http.X-Reverse-Proxy-TTL) {
C{
Expand All @@ -347,6 +351,12 @@ you need to extend your varnish ``vcl_fetch`` configuration:
}
}

The import for ``stdlib.h`` has to be outside of any ``vcl_X`` sub routines.
Omitting the ``stdlib`` inclusion will result in a compile error complaining
that ``atoi`` is not defined, and including the header file inside a VCL sub
routine leads to a C compile failure mentioning
``invalid storage class for function __bswap_32``.

Note that there is a ``beresp.ttl`` field in VCL but unfortunately it can only
be set to absolute values and not dynamically. Thus we have to revert to a C
code fragment.