From: Willy Tarreau Date: Fri, 15 Jun 2018 17:41:31 +0000 (+0200) Subject: MINOR: stats: adapt to the new buffers API X-Git-Tag: v1.9-dev1~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=97f538b895211583aa2de457e4af99f4cf6a7e84;p=thirdparty%2Fhaproxy.git MINOR: stats: adapt to the new buffers API The changes are fairly straightforward. Some places require to trim the length. Maybe we'd need a b_extend() or b_adjust() for this. --- diff --git a/src/stats.c b/src/stats.c index aa4aaaaaa9..c0c1b35a76 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3054,7 +3054,7 @@ static void http_stats_io_handler(struct appctx *appctx) } if (appctx->st0 == STAT_HTTP_DUMP) { - unsigned int prev_len = si_ib(si)->i; + unsigned int prev_len = ci_data(si_ic(si)); unsigned int data_len; unsigned int last_len; unsigned int last_fwd = 0; @@ -3075,11 +3075,11 @@ static void http_stats_io_handler(struct appctx *appctx) } } - data_len = si_ib(si)->i; + data_len = ci_data(si_ic(si)); if (stats_dump_stat_to_buffer(si, s->be->uri_auth)) appctx->st0 = STAT_HTTP_DONE; - last_len = si_ib(si)->i; + last_len = ci_data(si_ic(si)); /* Now we must either adjust or remove the chunk size. This is * not easy because the chunk size might wrap at the end of the @@ -3090,7 +3090,7 @@ static void http_stats_io_handler(struct appctx *appctx) */ if (appctx->ctx.stats.flags & STAT_CHUNKED) { si_ic(si)->total -= (last_len - prev_len); - si_ib(si)->i -= (last_len - prev_len); + b_sub(si_ib(si), (last_len - prev_len)); if (last_len != data_len) { chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len)); @@ -3098,7 +3098,7 @@ static void http_stats_io_handler(struct appctx *appctx) si_applet_cant_put(si); si_ic(si)->total += (last_len - data_len); - si_ib(si)->i += (last_len - data_len); + b_add(si_ib(si), last_len - data_len); } /* now re-enable forwarding */ channel_forward(si_ic(si), last_fwd); @@ -3126,7 +3126,7 @@ static void http_stats_io_handler(struct appctx *appctx) } } /* eat the whole request */ - co_skip(si_oc(si), si_ob(si)->o); + co_skip(si_oc(si), co_data(si_oc(si))); res->flags |= CF_READ_NULL; si_shutr(si); }