Ticket #539 (closed defect: fixed)

Opened 12 months ago

Last modified 12 months ago

unable to compare two headers in vcl

Reported by: hamnis Owned by: phk
Priority: normal Milestone:
Component: varnishd Version: trunk
Severity: critical Keywords:
Cc:

Description

sub vcl_fetch {
    if (obj.http.etag ~ req.http.if-none-match) {
      error 304 "Not Modified";
    }
}

causes compile error. Message from VCC-compiler: Expected CSTR got 'req.http.if-none-match' (program line 255), at (input Line 92 Pos 25)

if (obj.http.etag ~ req.http.if-none-match) {


Running VCC-compiler failed, exit 1 VCL compilation failed

Change History

Changed 12 months ago by hamnis

The right hand side of the expression is not evaluated.

Changed 12 months ago by phk

  • status changed from new to closed
  • resolution set to fixed

The exact scenario you propose is unlikely to be possible, because compiling regular expressions is horribly expensive (malloc overhead amongst other things).

The other half of it, is that it is so suicidal to allow a client to send you regexps that it defies description.

(In VCL we precompile the regular expressions at load-time to minimize this overhead.)

In r4186 I have changed the VCL compiler so that the "==" and "!=" operators take general strings as arguments, so replacing your "~" with "==" the above should now be possible.

Note: See TracTickets for help on using tickets.