r1080 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Sep 18 21:47:30 CEST 2006


Author: phk
Date: 2006-09-18 21:47:30 +0200 (Mon, 18 Sep 2006)
New Revision: 1080

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
More backend error conditions changed from assert to 503


Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-18 19:38:35 UTC (rev 1079)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-18 19:47:30 UTC (rev 1080)
@@ -550,6 +550,7 @@
 			HSH_Deref(sp->obj);
 			sp->obj = NULL;
 			sp->step = STP_DONE;
+			RES_Error(sp, 503, NULL);
 			return (0);
 		}
 		sp->step = STP_FETCH;

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-09-18 19:38:35 UTC (rev 1079)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-09-18 19:47:30 UTC (rev 1080)
@@ -322,16 +322,23 @@
 
 	WRK_Reset(w, &vc->fd);
 	http_Write(w, vc->http, 0);
-	i = WRK_Flush(w);
-	xxxassert(i == 0);
+	if (WRK_Flush(w)) {
+		/* XXX: cleanup */
+		return (1);
+	}
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
 
-	i = http_RecvHead(vc->http, vc->fd);
-	xxxassert(i == 0);
-	xxxassert(http_DissectResponse(sp->wrk, vc->http, vc->fd) == 0);
+	if (http_RecvHead(vc->http, vc->fd)) {
+		/* XXX: cleanup */
+		return (1);
+	}
+	if (http_DissectResponse(sp->wrk, vc->http, vc->fd)) {
+		/* XXX: cleanup */
+		return (1);
+	}
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-09-18 19:38:35 UTC (rev 1079)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-09-18 19:47:30 UTC (rev 1080)
@@ -421,6 +421,10 @@
 	for (p = hp->s ; isspace(*p); p++)
 		continue;
 
+	if (memcmp(p, "HTTP/1.", 7)) {
+		WSLR(w, SLT_HttpGarbage, fd, hp->s, hp->v);
+		return (400);
+	}
 	/* First, protocol */
 	hp->hd[HTTP_HDR_PROTO].b = p;
 	while (!isspace(*p))




More information about the varnish-commit mailing list