Hi Cyril,

On Wed, Oct 24, 2012 at 08:33:57PM +0200, Cyril Bonté wrote:
> Hi Willy,
> 
> Le 24/10/2012 01:48, Willy Tarreau a écrit :
> >Either way, now the doc does not reflect reality, so we must address the
> >issue. I don't think that anything is missing anymore to have the IPv6
> >address parser to fill the gap. The smp_fetch_hdr() function was rewritten
> >precisely to address this need, inet_pton and a few skips of square
> >brakets should be all that's needed. Hmmm I think I get it now. inet_pton
> >needs a zero-terminated string and for this we needed to copy the address
> >to the sample trash chunk (using sample_get_trash_chunk()), trim it, and
> >parse it from there using inet_pton(). We can do that when url2ipv4
> >returns zero it seems, as it stops on anything not a digit nor a dot, and
> >wants 3 dots.
> >
> >I probably won't have time to look into this tomorrow, so if you can, once
> >again your fix will be welcome !
> 
> Yes of course, I can work on it, but probably not before some days for 
> me too. Thanks for pointing me to sample_get_trash_chunk(), this will help.
> I had a quick look on it today, I'm not sure I'll use samples correctly, 
> so maybe the first patch will require some re-reads and comments ;-)

No problem. The principle is quite simple: a fetch function is called with
a pointer to a sample in which to store the type and contents. If contents
need storage, you put them in a buffer-sized chunk returned by
sample_get_trash_chunk(). If the fetch callers need to convert the contents,
they call sample_get_trash_chunk() again and get the alternate buffer to
store the conversion.

Don't worry, we'll help you :-)

Thanks,
Willy


Reply via email to