Commit a97bff7e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Pass the max number of bytes to be received into SES_RxStuff() as parameter.

parent f9f6b2a4
......@@ -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); \
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 +=
......
......@@ -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);
......
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