From: phk Date: Mon, 18 Sep 2006 19:47:30 +0000 (+0000) Subject: More backend error conditions changed from assert to 503 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=107dafc5b69cedce8f6429a5281ba45dc6cb8f7e;p=varnish More backend error conditions changed from assert to 503 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1080 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 482fd4e0..e55008f3 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -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; diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index b8752c50..a83c01c2 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -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); diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index da869f7d..43f90c21 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -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))