Time to retire client.identify?

Federico Schwindt fgsch at lodoss.net
Thu Jul 2 17:23:11 CEST 2015


One of the things Dag pointed about this is that if you want to hash based
on the client IP address you will need to do "" + client.ip.
This is a valid concern although the only situation I can think of where
client.identity will be missed.

There are a few options:

1. Use "" + client.ip. Somewhat ugly but will do the job.

2. Do automatic conversion for arguments when the expected type is STRING
or STRING_LIST. See diff below.
We do this already in a number of places but not for arguments.

3. Stash it in the req.http space. e.g.

set req.http.session = client.ip;
set req.backend_hint = hash.backend(req.http.session);
#unset req.http.session;

4. Change the hash director to use client.identity again. e.g. drop the
STRING_LIST and use client.identity.

5. Do nothing.

As things are in master, client.identity lost it's place and it's more like
a scratch space or throw away variable and feels like a special case but
YMMV.

Any opinions?

f.-

diff --git a/lib/libvcc/vcc_expr.c
b/lib/libvcc/vcc_expr.c
index b9c6531..4019fec 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -609,6 +609,9 @@ vcc_do_arg(struct vcc *tl, struct func_arg *fa)
        } else {
                vcc_expr0(tl, &e2, fa->type);
                ERRCHK(tl);
+               if (e2->fmt != fa->type &&
+                   (fa->type == STRING || fa->type == STRING_LIST))
+                       vcc_expr_tostring(tl, &e2, fa->type);
                if (e2->fmt != fa->type) {
                        VSB_printf(tl->sb, "Wrong argument type.");
                        VSB_printf(tl->sb, "  Expected %s.",




On Thu, Jul 2, 2015 at 1:48 PM, Martin Blix Grydeland <
martin at varnish-software.com> wrote:

> Yeah, this is OBE now.
>
> Martin
>
> On 1 July 2015 at 15:58, Dridi Boukelmoune <dridi at varni.sh> wrote:
>
>> On Wed, Jul 1, 2015 at 3:05 PM, Federico Schwindt <fgsch at lodoss.net>
>> wrote:
>> > Hi,
>> >
>> > The hash director needs a string now so this no longer needed.
>> >
>> > Opinions?
>>
>> Agreed
>>
>> _______________________________________________
>> varnish-dev mailing list
>> varnish-dev at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>>
>
>
>
> --
> <http://varnish-software.com>*Martin Blix Grydeland*
> Senior Developer | Varnish Software AS
> Mobile: +47 992 74 756
> We Make Websites Fly!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20150702/f48d9dd7/attachment.html>


More information about the varnish-dev mailing list