Commit 8e216d58 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make it the callers responsibility to release the workspace

parent b3a74ff9
......@@ -214,19 +214,11 @@ SES_Rx(struct http_conn *htc)
AZ(htc->pipeline_b);
AZ(htc->pipeline_e);
i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */
if (i <= 0) {
WS_ReleaseP(htc->ws, htc->rxbuf_b);
if (i <= 0)
return (HTC_S_OVERFLOW);
}
i = read(htc->fd, htc->rxbuf_e, i);
if (i <= 0) {
/*
* We wouldn't come here if we had a complete HTTP header
* so consequently an EOF can not be OK
*/
WS_ReleaseP(htc->ws, htc->rxbuf_b);
if (i <= 0)
return (HTC_S_EOF);
}
htc->rxbuf_e += i;
*htc->rxbuf_e = '\0';
return (HTC_S_OK);
......
......@@ -157,6 +157,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
if (hs == HTC_S_OK)
hs = HTTP1_Complete(htc);
if (hs == HTC_S_OVERFLOW) {
WS_ReleaseP(htc->ws, htc->rxbuf_b);
bo->acct.beresp_hdrbytes +=
htc->rxbuf_e - htc->rxbuf_b;
VSLb(bo->vsl, SLT_FetchError,
......@@ -166,6 +167,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
return (-1);
}
if (hs == HTC_S_EOF) {
WS_ReleaseP(htc->ws, htc->rxbuf_b);
bo->acct.beresp_hdrbytes +=
htc->rxbuf_e - htc->rxbuf_b;
VSLb(bo->vsl, SLT_FetchError, "http %sread error: EOF",
......
......@@ -95,9 +95,11 @@ http1_wait(struct sess *sp, struct worker *wrk, struct req *req)
req->htc->rxbuf_e - req->htc->rxbuf_b;
return (REQ_FSM_MORE);
} else if (hs == HTC_S_EOF) {
WS_ReleaseP(req->htc->ws, req->htc->rxbuf_b);
why = SC_REM_CLOSE;
break;
} else if (hs == HTC_S_OVERFLOW) {
WS_ReleaseP(req->htc->ws, req->htc->rxbuf_b);
why = SC_RX_OVERFLOW;
break;
} else if (hs == HTC_S_EMPTY) {
......
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