From daa356bd7d9a04c69b709842d09ceb623aa0705f Mon Sep 17 00:00:00 2001 From: Ben51Degrees Date: Wed, 16 Jan 2019 10:19:15 +0000 Subject: [PATCH] BUG: 51d: Changes to the buffer API in 1.9 were not applied to the 51Degrees code. The code using the deprecated 'buf->p' has been updated to use 'ci_head(buf)' as described in section 5 of 'doc/internals/buffer-api.txt'. A compile time switch on 'BUF_NULL' has also been added to enable the same source code to be used with pre and post API change HAProxy. This should be backported to 1.9, and is compatible with previous versions. --- src/51d.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/51d.c b/src/51d.c index 4f4942138..20760d639 100644 --- a/src/51d.c +++ b/src/51d.c @@ -233,7 +233,13 @@ static void _51d_set_headers(struct sample *smp, fiftyoneDegreesWorkset *ws) ctx.idx = 0; if (http_find_full_header2((global_51degrees.header_names + i)->area, (global_51degrees.header_names + i)->data, - msg->chn->buf->p, idx, &ctx) == 1) { +#ifndef BUF_NULL + msg->chn->buf->p, +#else + ci_head(msg->chn), +#endif + idx, + &ctx) == 1) { ws->importantHeaders[ws->importantHeadersCount].header = ws->dataSet->httpHeaders + i; ws->importantHeaders[ws->importantHeadersCount].headerValue = ctx.line + ctx.val; ws->importantHeaders[ws->importantHeadersCount].headerValueLength = ctx.vlen; @@ -260,7 +266,14 @@ static void _51d_set_device_offsets(struct sample *smp) ctx.idx = 0; if (http_find_full_header2((global_51degrees.header_names + index)->area, (global_51degrees.header_names + index)->data, - msg->chn->buf->p, idx, &ctx) == 1) { +#ifndef BUF_NULL + msg->chn->buf->p, +#else + ci_head(msg->chn), +#endif + idx, + &ctx) == 1) { + (offsets->firstOffset + offsets->size)->httpHeaderOffset = *(global_51degrees.header_offsets + index); (offsets->firstOffset + offsets->size)->deviceOffset = fiftyoneDegreesGetDeviceOffset(&global_51degrees.data_set, ctx.line + ctx.val); offsets->size++;