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