]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: 51d: Changes to the buffer API in 1.9 were not applied to the 51Degrees code.
authorBen51Degrees <Ben@51Degrees.com>
Wed, 16 Jan 2019 10:19:15 +0000 (10:19 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Jan 2019 16:26:14 +0000 (17:26 +0100)
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

index 4f4942138d244860fda0bb27dc65aef2877b6f1f..20760d639ef81f87f2d48901c45638696b653541 100644 (file)
--- 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++;