[Varnish] #1145: PRIV_CALL returns same object on different function parameters

Varnish varnish-bugs at varnish-cache.org
Fri Jun 1 14:39:35 CEST 2012


#1145: PRIV_CALL returns same object on different function parameters
-----------------------+----------------------------------------------------
 Reporter:  tobixen    |        Type:  defect
   Status:  new        |    Priority:  normal
Milestone:             |   Component:  build 
  Version:  3.0.2      |    Severity:  normal
 Keywords:  PRIV_CALL  |  
-----------------------+----------------------------------------------------
Description changed by tfheen:

Old description:

> I'm on varnish 3.0.2 ... git rev 8015b1ab869a60cb220b5d20ef7b6d183cea64ab
>
> VCL_PRIV returns same object on different function call parameters.  This
> causes the test suit of my vmod to break - https://github.com/tobixen
> /libvmod-ratelimit - and it also causes the caching in std.fileread to
> break.
>
> Consider this VCL code:
>
> import std;
>
> backend default {
>      .host = "80.91.37.212";
>      .port = "80";
> }
>
> sub vcl_deliver {
>     set resp.http.foo = std.fileread("/tmp/" + req.http.host);
> }
>
> And then I did this:
>
> $ grep aftenposten /etc/hosts
> 127.0.0.1       aftenposten.no  www.aftenposten.no
>
> $ cd /tmp/
>
> $ echo www > www.aftenposten.no
>
> $ echo no-www > aftenposten.no
>
> $ sudo kill `cat /var/run/varnish.pid `
>
> $ sudo /usr/local/sbin/varnishd -P /var/run/varnish.pid -a :80 -T
> localhost:6082  -u varnish -g varnish -s
> file,/var/lib/varnish/varnish_storage.bin,2G  -f ~/varnish.vcl
>
> $ curl -sI http://www.aftenposten.no/ | grep foo
> foo: www
>
> $ curl -sI http://aftenposten.no/ | grep foo
> foo: www
>
> $ sudo kill `cat /var/run/varnish.pid `
>
> $ sudo /usr/local/sbin/varnishd -P /var/run/varnish.pid -a :80 -T
> localhost:6082  -u varnish -g varnish -s
> file,/var/lib/varnish/varnish_storage.bin,2G  -f ~/varnish.vcl
>
> $ curl -sI http://aftenposten.no/ | grep foo
> foo: no-www
>
> $ curl -sI http://www.aftenposten.no/ | grep foo
> foo: no-www

New description:

 I'm on varnish 3.0.2 ... git rev 8015b1ab869a60cb220b5d20ef7b6d183cea64ab

 VCL_PRIV returns same object on different function call parameters.  This
 causes the test suit of my vmod to break - https://github.com/tobixen
 /libvmod-ratelimit - and it also causes the caching in std.fileread to
 break.

 Consider this VCL code:

 {{{
 import std;

 backend default {
      .host = "80.91.37.212";
      .port = "80";
 }

 sub vcl_deliver {
     set resp.http.foo = std.fileread("/tmp/" + req.http.host);
 }
 }}}

 And then I did this:

 {{{
 $ grep aftenposten /etc/hosts
 127.0.0.1       aftenposten.no  www.aftenposten.no

 $ cd /tmp/

 $ echo www > www.aftenposten.no

 $ echo no-www > aftenposten.no

 $ sudo kill `cat /var/run/varnish.pid `

 $ sudo /usr/local/sbin/varnishd -P /var/run/varnish.pid -a :80 -T
 localhost:6082  -u varnish -g varnish -s
 file,/var/lib/varnish/varnish_storage.bin,2G  -f ~/varnish.vcl

 $ curl -sI http://www.aftenposten.no/ | grep foo
 foo: www

 $ curl -sI http://aftenposten.no/ | grep foo
 foo: www

 $ sudo kill `cat /var/run/varnish.pid `

 $ sudo /usr/local/sbin/varnishd -P /var/run/varnish.pid -a :80 -T
 localhost:6082  -u varnish -g varnish -s
 file,/var/lib/varnish/varnish_storage.bin,2G  -f ~/varnish.vcl

 $ curl -sI http://aftenposten.no/ | grep foo
 foo: no-www

 $ curl -sI http://www.aftenposten.no/ | grep foo
 foo: no-www
 }}}

--

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1145#comment:1>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list