Commit 82c4b095 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Don't assert if we fail to get storage in VFP_Begin()

Fixes	#1100

Conflicts:

	bin/varnishd/cache_fetch.c
	bin/varnishd/cache_panic.c
parent 10e4f972
...@@ -80,13 +80,16 @@ FetchError(const struct sess *sp, const char *error) ...@@ -80,13 +80,16 @@ FetchError(const struct sess *sp, const char *error)
* VFP method functions * VFP method functions
*/ */
static void static int
VFP_Begin(struct sess *sp, size_t estimate) VFP_Begin(struct sess *sp, size_t estimate)
{ {
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
AN(sp->wrk->vfp); AN(sp->wrk->vfp);
sp->wrk->vfp->begin(sp, estimate); sp->wrk->vfp->begin(sp, estimate);
if (sp->wrk->fetch_failed)
return (-1);
return (0);
} }
static int static int
...@@ -150,7 +153,6 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes) ...@@ -150,7 +153,6 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
ssize_t l, w; ssize_t l, w;
struct storage *st; struct storage *st;
AZ(sp->wrk->fetch_failed);
while (bytes > 0) { while (bytes > 0) {
st = FetchStorage(sp, 0); st = FetchStorage(sp, 0);
if (st == NULL) if (st == NULL)
...@@ -555,21 +557,24 @@ FetchBody(struct sess *sp) ...@@ -555,21 +557,24 @@ FetchBody(struct sess *sp)
break; break;
case BS_LENGTH: case BS_LENGTH:
cl = fetch_number(sp->wrk->h_content_length, 10); cl = fetch_number(sp->wrk->h_content_length, 10);
VFP_Begin(sp, cl > 0 ? cl : 0); cls = VFP_Begin(sp, cl > 0 ? cl : 0);
if (!cls)
cls = fetch_straight(sp, w->htc, cl); cls = fetch_straight(sp, w->htc, cl);
mklen = 1; mklen = 1;
if (VFP_End(sp)) if (VFP_End(sp))
cls = -1; cls = -1;
break; break;
case BS_CHUNKED: case BS_CHUNKED:
VFP_Begin(sp, cl); cls = VFP_Begin(sp, cl);
if (!cls)
cls = fetch_chunked(sp, w->htc); cls = fetch_chunked(sp, w->htc);
mklen = 1; mklen = 1;
if (VFP_End(sp)) if (VFP_End(sp))
cls = -1; cls = -1;
break; break;
case BS_EOF: case BS_EOF:
VFP_Begin(sp, cl); cls = VFP_Begin(sp, cl);
if (!cls)
cls = fetch_eof(sp, w->htc); cls = fetch_eof(sp, w->htc);
mklen = 1; mklen = 1;
if (VFP_End(sp)) if (VFP_End(sp))
......
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