adding a double quote into a regsub in vcl_fetch

Stefan Caunter stef at scaleengine.com
Wed Oct 16 01:55:38 CEST 2013


On Tue, Oct 15, 2013 at 7:44 PM, Paul A. Procacci
<pprocacci at datapipe.com> wrote:
> On Tue, Oct 15, 2013 at 07:16:45PM -0400, Stefan Caunter wrote:
>> On Tue, Oct 15, 2013 at 7:03 PM, Paul A. Procacci
>> <pprocacci at datapipe.com> wrote:
>> > Yep,
>> >
>> > I see that now.  Didn't realize the parser was that picky.
>> >
>> > "
>> >
>> > Can you use the above in place of a double quote?
>> >
>> > I.E:
>> >   set beresp.http.Link = regsub(req.url, "^/blah.*", "<http://example.com/blah>; rel="canonical" ");
>> >
>>
>> it faithfully prints that out
>>
>> Link: <http://example.com/blah>; rel="canonical"
>
> Instead of the back and forth, how about from the documenation:
> (https://www.varnish-cache.org/trac/wiki/VCLSyntaxStrings)
>
> "Given that we have never been able to come up with a valid need for any escaped characters apart from that, we decided that %22 for " and %25 for %, was much less suffering than doubling all backslashes in regexp/regsub contexts."
>

ah, from that page, the long string syntax works, i.e. {" payload
including "double quotes" "}

set beresp.http.Link = regsub(req.url, "^/blah.*",
{"<http://example.com/blah>; rel="canonical""});

thanks for getting me there

S



More information about the varnish-misc mailing list