Commit b39db7f6 authored by Kristian Lyngstøl's avatar Kristian Lyngstøl

generate vcl.7 from rst, include default.vcl in vcl.rst

git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5009 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 1cb7b206
...@@ -583,105 +583,8 @@ specified::: ...@@ -583,105 +583,8 @@ specified:::
.port = "http"; .port = "http";
} }
sub vcl_recv { .. include:: ../../../man/default.vcl
if (req.http.x-forwarded-for) { :literal:
set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "POST" &&
req.request != "TRACE" &&
req.request != "OPTIONS" &&
req.request != "DELETE") {
// Non-RFC2616 or CONNECT which is weird.
return (pipe);
}
if (req.request != "GET" && req.request != "HEAD") {
// We only deal with GET and HEAD by default
return (pass);
}
if (req.http.Authorization || req.http.Cookie) {
// Not cacheable by default
return (pass);
}
return (lookup);
}
sub vcl_pipe {
# Note that only the first request to the backend will have
# X-Forwarded-For set. If you use X-Forwarded-For and want to
# have it set for all requests, make sure to have:
# set req.http.connection = "close";
# here. It is not set by default as it might break some broken web
# applications, like IIS with NTLM authentication.
return (pipe);
}
sub vcl_pass {
return (pass);
}
sub vcl_hash {
set req.hash += req.url;
if (req.http.host) {
set req.hash += req.http.host;
} else {
set req.hash += server.ip;
}
return (hash);
}
sub vcl_hit {
if (!obj.cacheable) {
return (pass);
}
return (deliver);
}
sub vcl_miss {
return (fetch);
}
sub vcl_fetch {
if (!beresp.cacheable) {
return (pass);
}
if (beresp.http.Set-Cookie) {
return (pass);
}
return (deliver);
}
sub vcl_deliver {
return (deliver);
}
sub vcl_error {
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>"} obj.status " " obj.response {"</title>
</head>
<body>
<h1>Error "} obj.status " " obj.response {"</h1>
<p>"} obj.response {"</p>
<h3>Guru Meditation:</h3>
<p>XID: "} req.xid {"</p>
<hr>
Varnish cache server
</body>
</html>
"};
return (deliver);
}
The following example shows how to support multiple sites running on The following example shows how to support multiple sites running on
separate backends in the same Varnish instance, by selecting backends separate backends in the same Varnish instance, by selecting backends
......
# $Id$ # $Id$
EXTRA_DIST = vcl.7so
DISTCLEANFILES = vcl.7 default.vcl DISTCLEANFILES = vcl.7 default.vcl
if HAVE_RST2MAN
dist_man_MANS = vcl.7 dist_man_MANS = vcl.7
endif
vcl.7: vcl.7so default.vcl Makefile
soelim $(srcdir)/vcl.7so > $@
default.vcl: $(top_srcdir)/bin/varnishd/default.vcl Makefile default.vcl: $(top_srcdir)/bin/varnishd/default.vcl Makefile
sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/default.vcl > $@ sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/default.vcl > $@
vcl.7: ../doc/sphinx/reference/vcl.rst default.vcl
if HAVE_RST2MAN
${RST2MAN} $< >$@
else
@echo "========================================"
@echo "You need rst2man installed to make dist"
@echo "========================================"
@false
endif
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment