我正在使用清漆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