Upper and lower case strings in Varnish

Cosimo Streppone cosimo at streppone.it
Wed Feb 3 20:52:32 CET 2010


On 3 February 2010 17:15, Richard Chiswell
<richard.chiswell at mangahigh.com> wrote:

>> Hi Poul,
>>
>> Poul-Henning Kamp wrote:
>>> In message <4B69AB1A.6010406 at mangahigh.com>, Richard Chiswell writes:
>>>
>>>> I've got a simple question which I've been puzzling on for the last 30
>>>> minutes or so - how do you change a string in Varnish to lowercase?
>>>>
>>> You'll have to use a bit of inline C code to do that.

I'm no varnish or C expert, YMMV etc...
but I managed to get something like this working.

It's a VCL with embedded C that reads the "Accept-Language" header
and rewrites it (or writes into a different header, actually) the
result of some processing function.

Take a look at the examples here:

http://github.com/cosimo/varnish-accept-language/tree/master/examples

sample.vcl is the main VCL file, from which you embed the other one,
accept-language.vcl, which in turn contains the C function you want
to use.

I think `vcl_rewrite_accept_language()' is what you need.
Then you're only missing the upper->lower case bit.

-- 
Cosimo



More information about the varnish-misc mailing list