[master] a97bff7 Pass the max number of bytes to be received into SES_RxStuff() as parameter.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Apr 5 12:13:05 CEST 2016
commit a97bff7e4e6f4d3c41b4cd37e9e9b3460d967e80
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Apr 5 09:16:43 2016 +0000
Pass the max number of bytes to be received into SES_RxStuff() as parameter.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 5e4fb89..9789b4d 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -965,7 +965,7 @@ enum htc_status_e {
void SES_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes);
void SES_RxReInit(struct http_conn *htc);
enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *,
- double *t1, double *t2, double ti, double tn);
+ double *t1, double *t2, double ti, double tn, int maxbytes);
#define SESS_ATTR(UP, low, typ, len) \
int SES_Set_##low(const struct sess *sp, const typ *src); \
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index b96aa9a..6b5cccb 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -236,7 +236,7 @@ SES_RxReInit(struct http_conn *htc)
enum htc_status_e
SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
- double *t1, double *t2, double ti, double tn)
+ double *t1, double *t2, double ti, double tn, int maxbytes)
{
double tmo;
double now;
@@ -275,7 +275,8 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
tmo = tn - now;
if (!isnan(ti) && ti < tn)
tmo = ti - now;
- i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */
+ i = (htc->rxbuf_e - htc->rxbuf_b) + 1L; /* space for NUL */
+ i = maxbytes - i;
if (i <= 0) {
WS_ReleaseP(htc->ws, htc->rxbuf_b);
return (HTC_S_OVERFLOW);
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index 4c3de64..902076a 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -157,7 +157,7 @@ V1F_FetchRespHdr(struct busyobj *bo)
t = VTIM_real() + htc->first_byte_timeout;
hs = SES_RxStuff(htc, HTTP1_Complete, NULL, NULL,
- t, t + htc->between_bytes_timeout);
+ t, t + htc->between_bytes_timeout, cache_param->http_resp_size);
if (hs != HTC_S_COMPLETE) {
bo->acct.beresp_hdrbytes +=
htc->rxbuf_e - htc->rxbuf_b;
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 9dd8b3b..3dd63b0 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -323,7 +323,8 @@ HTTP1_Session(struct worker *wrk, struct req *req)
hs = SES_RxStuff(req->htc, HTTP1_Complete,
&req->t_first, &req->t_req,
sp->t_idle + cache_param->timeout_linger,
- sp->t_idle + cache_param->timeout_idle);
+ sp->t_idle + cache_param->timeout_idle,
+ cache_param->http_req_size);
XXXAZ(req->htc->ws->r);
if (hs < HTC_S_EMPTY) {
req->acct.req_hdrbytes +=
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index ea0d676..3c9cffe 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -351,8 +351,8 @@ vpx_new_session(struct worker *wrk, void *arg)
assert(sizeof vpx2_sig == 12);
hs = SES_RxStuff(req->htc, vpx_complete,
- NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle);
- XXXAZ(req->htc->ws->r);
+ NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle,
+ 1024); // XXX ?
if (hs != HTC_S_COMPLETE) {
Req_Release(req);
SES_Delete(sp, SC_RX_JUNK, NAN);
More information about the varnish-commit
mailing list