使用内联C扩展Varnish

(这里有龙。又大又卑鄙的。)

您可以使用 inline C 来扩展瓦尼什。请注意,这样做可能会严重影响Varnish。C代码在Varnish缓存进程中运行,因此如果您的代码生成段错误,缓存将崩溃。

内联C的最早用法之一是记录到 syslog .::

# The include statements must be outside the subroutines.
C{
        #include <syslog.h>
}C

sub vcl_something {
        C{
                syslog(LOG_INFO, "Something happened at VCL line XX.");
        }C
}

要使用内联C,需要使用 vcc_allow_inline_c 参数。