Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

how to create variables

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


arundobriyaliitkgp at gmail

May 23, 2012, 5:42 AM

Post #1 of 5 (373 views)
Permalink
how to create variables

"How can I create string variables in the default.vcl file... Is it
possible to create variables and then use them.."

alternatively,

" Is it possible to use the vcl variables in the inline c code and
vice-versa ? "


Thanks,
Arun


tobias.eichelbroenner at lamp-solutions

May 23, 2012, 5:52 AM

Post #2 of 5 (365 views)
Permalink
Re: how to create variables [In reply to]

Hi,

> "How can I create string variables in the default.vcl file... Is it
> possible to create variables and then use them.."

you can store informationen in the http-header

in vcl:
req.http.X-Variable = "value";

and in inline c
VRT_GetHdr(sp, HDR_REQ, "\013X-Variable:")

VRT_SetHdr(sp, HDR_REQ, "\013X-Variable:", "value", vrt_magic_string_end);

Sincerely

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


perbu at varnish-software

May 23, 2012, 12:02 PM

Post #3 of 5 (364 views)
Permalink
Re: how to create variables [In reply to]

Hi Arun,

On Wed, May 23, 2012 at 2:42 PM, Arun Dobriyal <arundobriyaliitkgp [at] gmail
> wrote:

> "How can I create string variables in the default.vcl file... Is it
> possible to create variables and then use them.."
>

Have a look at Tollefs excellent Variable VMOD.

https://www.varnish-cache.org/vmod/variable-support

Also, as Tobias mentioned. The old school way is to stuff things into HTTP
headers. :-)
--
Per Buer
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
*Varnish makes websites fly!*
Whitepapers <http://www.varnish-software.com/whitepapers> |
Video<http://www.youtube.com/watch?v=x7t2Sp174eI> |
Twitter <https://twitter.com/varnishsoftware>


arundobriyaliitkgp at gmail

May 23, 2012, 9:06 PM

Post #4 of 5 (358 views)
Permalink
Re: how to create variables [In reply to]

Thanks Per and Tobias.. http headers is a good way :)



On Thu, May 24, 2012 at 12:32 AM, Per Buer <perbu [at] varnish-software>wrote:

> Hi Arun,
>
> On Wed, May 23, 2012 at 2:42 PM, Arun Dobriyal <
> arundobriyaliitkgp [at] gmail> wrote:
>
>> "How can I create string variables in the default.vcl file... Is it
>> possible to create variables and then use them.."
>>
>
> Have a look at Tollefs excellent Variable VMOD.
>
> https://www.varnish-cache.org/vmod/variable-support
>
> Also, as Tobias mentioned. The old school way is to stuff things into HTTP
> headers. :-)
> --
> Per Buer
> Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
> *Varnish makes websites fly!*
> Whitepapers <http://www.varnish-software.com/whitepapers> | Video<http://www.youtube.com/watch?v=x7t2Sp174eI> |
> Twitter <https://twitter.com/varnishsoftware>
>
>
>


--
Arun Dobriyal,
Fifth year Dual Degree Student,
Department of Computer Science and Engineering,
Indian Institute of Technology, Kharagpur,
India.


arundobriyaliitkgp at gmail

May 24, 2012, 5:29 AM

Post #5 of 5 (355 views)
Permalink
Re: how to create variables [In reply to]

I myself was having trouble with vmods, for the people who are looking at
the vmods for the first time,
probably the better way to understand them is by writing the vcl file and
running "varnishd" with "-C" option,
this option shows the c code generated for the vcl logic written in the
default.vcl file..
by this method, one can easily check how the vcl code is converted into its
corresponding c code,
and it would serve as a big help so as how to use/introduce variables in
vcl logic.

-Arun

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.