Thanks here a proposed patch.

Kind regards.

On Tue, 15 Jan 2019 at 13:10, Willy Tarreau <[email protected]> wrote:
>
> Hi David,
>
> On Tue, Jan 15, 2019 at 11:12:16AM +0000, David Carlier wrote:
> > Hi dear list,
> >
> > A customer of use encountered an issue while compiling with the
> > DeviceAtlas module.
>
> Ah! At least one of the device detection modules gets tested! This is
> reassuring, because quite honestly I was wondering whether we should
> really keep all this code for 2.0 if there is so little testing :-/
>
> > Seems due to the struct buffer changes it underwent a little while ago
> > ... Could you confirm the area member is equivalent to the previous p
> > one ?
>
> No, it's a bit different. Please have a look at doc/internals/buffer-api.txt.
> It explains what changed. At the end of the file, there is a more complete
> description of what to replace by what for most common cases. In short,
> "area" replaces the old "data". For "p", it used to be the boundary between
> the input and the output data. Buffers don't contain input/output distinction
> anymore, they contain a data count ("data") and it's the channel which 
> contains
> the amount of this data which is for the output. Most often you'll have the
> channel present, so that you can replace :
>
>      chn->buf->p
>
> with :
>
>      ci_head(chn)
>
>
> If, for maintenance reasons, you need to keep the code exactly identical
> for 1.8 and 1.9 and you have so few occurrences that you can #ifdef the
> differences, you can rely on the existence of the macro "BUF_NULL" which
> was brought by the new buffer API.
>
> Hoping this helps,
> Willy
From dd941d98252d625ce5944411cec5f26d0c195ab2 Mon Sep 17 00:00:00 2001
From: David Carlier <[email protected]>
Date: Tue, 15 Jan 2019 12:09:00 +0000
Subject: [PATCH] BUILD/MEDIUM: da: Necessary code changes.

The most significant change from 1.8 to >=1.9 is the buffer
data structure, using the new field and fixing along side
a little hidden compilation warning.
---
 src/da.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/da.c b/src/da.c
index 61d6422e..0a49d529 100644
--- a/src/da.c
+++ b/src/da.c
@@ -309,7 +309,7 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
 	hidx = &smp->strm->txn->hdr_idx;
 	hmsg = &smp->strm->txn->req;
 
-	while (http_find_next_header(hmsg->chn->buf->p, hidx, &hctx) == 1 &&
+	while (http_find_next_header(ci_head(hmsg->chn), hidx, &hctx) == 1 &&
 	        nbh < DA_MAX_HEADERS) {
 		char *pval;
 		size_t vlen;
@@ -331,7 +331,7 @@ static int da_haproxy_fetch(const struct arg *args, struct sample *smp, const ch
 				atlas);
 		} else if (strcmp(hbuf, "Cookie") == 0) {
 			char *p, *eval;
-			int pl;
+			size_t pl;
 
 			eval = pval + hctx.vlen;
 			/**
-- 
2.20.1

Reply via email to