r2949 - trunk/varnish-cache/bin/varnishd

petter at projects.linpro.no petter at projects.linpro.no
Fri Jul 18 09:01:43 CEST 2008


Author: petter
Date: 2008-07-18 09:01:42 +0200 (Fri, 18 Jul 2008)
New Revision: 2949

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_synthetic.c
   trunk/varnish-cache/bin/varnishd/heritage.h
   trunk/varnish-cache/bin/varnishd/mgt_param.c
   trunk/varnish-cache/bin/varnishd/varnishd.1
Log:
Added the parameter err_ttl, which sets the TTL for synthesized error pages. Default value is 0. Fixes #126.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-07-18 00:19:03 UTC (rev 2948)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-07-18 07:01:42 UTC (rev 2949)
@@ -567,7 +567,7 @@
 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);

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2008-07-18 00:19:03 UTC (rev 2948)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2008-07-18 07:01:42 UTC (rev 2949)
@@ -309,7 +309,7 @@
 {
 
 	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 @@
 	*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);
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_synthetic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_synthetic.c	2008-07-18 00:19:03 UTC (rev 2948)
+++ trunk/varnish-cache/bin/varnishd/cache_synthetic.c	2008-07-18 07:01:42 UTC (rev 2949)
@@ -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 @@
 	unsigned u;
 	struct vsb vsb;
 	int fd;
-	int ttl = 0;				/* XXX: ?? */
 
 	WSL_Flush(sp->wrk, 0);
 	assert(status >= 100 && status <= 999);

Modified: trunk/varnish-cache/bin/varnishd/heritage.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/heritage.h	2008-07-18 00:19:03 UTC (rev 2948)
+++ trunk/varnish-cache/bin/varnishd/heritage.h	2008-07-18 07:01:42 UTC (rev 2949)
@@ -77,6 +77,9 @@
 
 	/* 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;

Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c	2008-07-18 00:19:03 UTC (rev 2948)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c	2008-07-18 07:01:42 UTC (rev 2949)
@@ -784,6 +784,10 @@
 		"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 }
 };
 

Modified: trunk/varnish-cache/bin/varnishd/varnishd.1
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.1	2008-07-18 00:19:03 UTC (rev 2948)
+++ trunk/varnish-cache/bin/varnishd/varnishd.1	2008-07-18 07:01:42 UTC (rev 2949)
@@ -389,6 +389,10 @@
 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.




More information about the varnish-commit mailing list