0

这是我得到的错误:

来自 VCC 编译器的消息:

未终止的字符串

(输入第 39 行,第 19 行)

if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|

------------------################################ #############

运行 VCC-compiler 失败,退出 1 VCL 编译失败

这是default.vcl

    backend default {
     .host = "localhost";
     .port = "8080";
}
acl purge {
        "localhost";
}
sub vcl_recv {
        if (req.request == "PURGE") {
                if (!client.ip ~ purge) {
                        error 405 "Not allowed.";
                }
                return(lookup);
        }
if (req.url ~ "^/$") {
               unset req.http.cookie;
            }
}
sub vcl_hit {
        if (req.request == "PURGE") {
                set obj.ttl = 0s;
                error 200 "Purged.";
        }
}
sub vcl_miss {
        if (req.request == "PURGE") {
                error 404 "Not in cache.";
        }
if (!(req.url ~ "wp-(login|admin)")) {
                        unset req.http.cookie;
                }
    if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|
zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$") {
       unset req.http.cookie;
       set req.url = regsub(req.url, "\?.$", "");
    }
    if (req.url ~ "^/$") {
       unset req.http.cookie;
    }
}
sub vcl_fetch {
        if (req.url ~ "^/$") {
                unset beresp.http.set-cookie;
        }
if (!(req.url ~ "wp-(login|admin)")) {
                        unset beresp.http.set-cookie;
}
}
4

2 回答 2

1

嗯,显然你不能在字符串中间有换行符。将字符串的尾端向上移动到它开始的行,或者有两个不同的字符串并用 + 连接它们。

于 2011-08-06T15:59:56.120 回答
1

如果你想要一个长字符串,你可以使用 {"Hello
World
I'm
long"}

于 2012-03-16T20:48:06.293 回答