我正在使用清漆4.0。内联C清漆(VCL_deliver)
我的后端也加入到了一些回应的HTTP标头“X-数”
我想的“X-数”值登录到带有换行符的文件。
我认为我应该在VCL交付。
这里是我到目前为止有:
sub vcl_deliver {
if (resp.http.x-count-this:) {
set resp.http.X-infodbg = "xx";
C{
FILE *fp;
fp = fopen("/tmp/test.txt", "w+");
fputs(VRT_GetHdr(sp, HDR_OBJ, "\013x-count-this:"), fp);
fputs("\n", fp);
fclose(fp);
}C
}
}
当然它不工作,并有一对夫妇的错误..
./vcl.gK2lu7uM.c: In function ‘VGC_function_vcl_deliver’: ./vcl.gK2lu7uM.c:1049:22: error: ‘sp’ undeclared (first use in this function) ./vcl.gK2lu7uM.c:1049:22: note: each undeclared identifier is reported only once for each function it appears in ./vcl.gK2lu7uM.c:1049:5: error: passing argument 2 of ‘VRT_GetHdr’ makes pointer from integer without a cast [-Werror] ./vcl.gK2lu7uM.c:330:7: note: expected ‘const struct gethdr_s *’ but argument is of type ‘int’ ./vcl.gK2lu7uM.c:1049:5: error: too many arguments to function ‘VRT_GetHdr’ ./vcl.gK2lu7uM.c:330:7: note: declared here
我不得不说,我只需复制/粘贴“sp”从一些例子,但我不知道它来自哪里(我想内联C是在不同的上下文,因此它被宣布在那里,但没有在vcl_deliver)
谢谢你,但.. “if”中的“:”是编辑问题,但“八进制值而不是十进制”是一个很好的提示。然而,“sp”变量仍然不存在,可能是一个Varnish 3/4的东西:( – cyqui 2014-09-08 07:59:15