Commit f8d70e1f authored by Petter Knudsen's avatar Petter Knudsen

Added the parameter err_ttl, which sets the TTL for synthesized error pages....

Added the parameter err_ttl, which sets the TTL for synthesized error pages. Default value is 0. Fixes #126.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2949 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 255d2fee
......@@ -567,7 +567,7 @@ void RES_BuildHttp(struct sess *sp);
void RES_WriteObj(struct sess *sp);
/* cache_synthetic.c */
void SYN_ErrorPage(struct sess *sp, int status, const char *reason);
void SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl);
/* cache_vary.c */
void VRY_Create(const struct sess *sp);
......
......@@ -309,7 +309,7 @@ cnt_error(struct sess *sp)
{
AZ(sp->obj);
SYN_ErrorPage(sp, sp->err_code, sp->err_reason);
SYN_ErrorPage(sp, sp->err_code, sp->err_reason, params->err_ttl);
sp->err_code = 0;
sp->err_reason = NULL;
sp->step = STP_DONE;
......@@ -878,7 +878,7 @@ cnt_start(struct sess *sp)
*sp->http0 = *sp->http;
if (done != 0) {
SYN_ErrorPage(sp, done, NULL); /* XXX: STP_ERROR ? */
SYN_ErrorPage(sp, done, NULL, params->err_ttl); /* XXX: STP_ERROR ? */
sp->step = STP_DONE;
return (0);
}
......
......@@ -47,7 +47,7 @@
*/
void
SYN_ErrorPage(struct sess *sp, int status, const char *reason)
SYN_ErrorPage(struct sess *sp, int status, const char *reason, int ttl)
{
struct http *h;
struct worker *w;
......@@ -57,7 +57,6 @@ SYN_ErrorPage(struct sess *sp, int status, const char *reason)
unsigned u;
struct vsb vsb;
int fd;
int ttl = 0; /* XXX: ?? */
WSL_Flush(sp->wrk, 0);
assert(status >= 100 && status <= 999);
......
......@@ -77,6 +77,9 @@ struct params {
/* TTL used for lack of anything better */
unsigned default_ttl;
/* TTL used for synthesized error pages */
unsigned err_ttl;
/* Worker threads and pool */
unsigned wthread_min;
......
......@@ -784,6 +784,10 @@ static const struct parspec parspec[] = {
"Use 0x notation and do the bitor in your head :-)\n",
0,
"0", "bitmap" },
{ "err_ttl", tweak_uint, &master.err_ttl, 0, UINT_MAX,
"The TTL assigned to the synthesized error pages\n",
0,
"0", "seconds" },
{ NULL, NULL, NULL }
};
......
......@@ -389,6 +389,10 @@ nor the configuration assign one.
Note that changes to this parameter are not applied retroactively.
.Pp
The default is 120 seconds.
.It Va err_ttl
The default time-to-live assigned to the synthesized error pages.
.Pp
The default is 0 seconds.
.It Va fetch_chunksize
The default chunk size used when retrieving documents for which the
backend server does not specify a content length.
......
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