varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

VCC handling missing for `if (resp.body)`

Open nigoroll opened this issue 2 years ago • 2 comments

vcl:

sub vcl_synth {
  if (resp.body) {
    set resp.status = 400;
  }
}

error:

**** v1    CLI RX|Message from VCC-compiler:
**** v1    CLI RX|Assert error in vcc_expr0(), vcc_expr.c line 1422:
**** v1    CLI RX|  Condition((*e)->fmt != BODY) not true.
**** v1    CLI RX|Running VCC-compiler failed, signal 6
**** v1    CLI RX|VCL compilation failed

Are we ready to just return resp.body as STRANDS or BLOB?

nigoroll avatar Mar 09 '22 16:03 nigoroll

Good catch!

That would suppose a workspace allocation, not sure we want to return anything. However, there could be a property or method to grab the length of the body:

sub vcl_synth {
  if (resp.body.len != 0) {
    set resp.status = 400;
  }
}

dridi avatar Mar 09 '22 17:03 dridi

This ticket is parked, pending VDD discussion about synth/error and body filters.

bsdphk avatar Mar 21 '22 14:03 bsdphk