]> err.no Git - varnish/commitdiff
More backend error conditions changed from assert to 503
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 18 Sep 2006 19:47:30 +0000 (19:47 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 18 Sep 2006 19:47:30 +0000 (19:47 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1080 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_http.c

index 482fd4e0a35bb3ec4129b48328212fca0a712ff2..e55008f315d59fafc8ade0e2f5632502c9d5b04a 100644 (file)
@@ -550,6 +550,7 @@ cnt_miss(struct sess *sp)
                        HSH_Deref(sp->obj);
                        sp->obj = NULL;
                        sp->step = STP_DONE;
+                       RES_Error(sp, 503, NULL);
                        return (0);
                }
                sp->step = STP_FETCH;
index b8752c5088ad59e324c8cd951367f8ec6e87a3c5..a83c01c2948ef888ffc5151c430a77eec42b811b 100644 (file)
@@ -322,16 +322,23 @@ FetchHeaders(struct sess *sp)
 
        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);
index da869f7db1cd74187a1b935b34134b97ce54fc58..43f90c21fa7cf37dff5998fea05485e8672ba766 100644 (file)
@@ -421,6 +421,10 @@ http_DissectResponse(struct worker *w, struct http *hp, int fd)
        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))