BUG/MINOR: contrib/prometheus-exporter: Don't use channel_htx_recv_max()
The function htx_free_data_space() must be used intead. Otherwise, if there are some output data not already forwarded, the maximum amount of data that may be inserted into the buffer may be greater than what we can really insert. This patch must be backported to 2.0.
This commit is contained in:
parent
f494957980
commit
e6cdfe574e
|
@ -1214,7 +1214,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
|
||||||
struct field metric;
|
struct field metric;
|
||||||
struct channel *chn = si_ic(appctx->owner);
|
struct channel *chn = si_ic(appctx->owner);
|
||||||
struct ist out = ist2(trash.area, 0);
|
struct ist out = ist2(trash.area, 0);
|
||||||
size_t max = channel_htx_recv_max(chn, htx);
|
size_t max = htx_free_data_space(htx);
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
|
@ -1427,7 +1427,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
|
||||||
struct field metric;
|
struct field metric;
|
||||||
struct channel *chn = si_ic(appctx->owner);
|
struct channel *chn = si_ic(appctx->owner);
|
||||||
struct ist out = ist2(trash.area, 0);
|
struct ist out = ist2(trash.area, 0);
|
||||||
size_t max = channel_htx_recv_max(chn, htx);
|
size_t max = htx_free_data_space(htx);
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
while (appctx->st2 && appctx->st2 < ST_F_TOTAL_FIELDS) {
|
while (appctx->st2 && appctx->st2 < ST_F_TOTAL_FIELDS) {
|
||||||
|
@ -1605,7 +1605,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
|
||||||
struct field metric;
|
struct field metric;
|
||||||
struct channel *chn = si_ic(appctx->owner);
|
struct channel *chn = si_ic(appctx->owner);
|
||||||
struct ist out = ist2(trash.area, 0);
|
struct ist out = ist2(trash.area, 0);
|
||||||
size_t max = channel_htx_recv_max(chn, htx);
|
size_t max = htx_free_data_space(htx);
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
uint32_t weight;
|
uint32_t weight;
|
||||||
|
|
||||||
|
@ -1824,7 +1824,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
|
||||||
struct field metric;
|
struct field metric;
|
||||||
struct channel *chn = si_ic(appctx->owner);
|
struct channel *chn = si_ic(appctx->owner);
|
||||||
struct ist out = ist2(trash.area, 0);
|
struct ist out = ist2(trash.area, 0);
|
||||||
size_t max = channel_htx_recv_max(chn, htx);
|
size_t max = htx_free_data_space(htx);
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
uint32_t weight;
|
uint32_t weight;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue