Add missing VRT_handled() check to catch return from the callback sub

I wonder who has written the vmod.rst documentation clearly pointing out
that this needs to be done... :|

Ref Varnish-Cache ff18a3c5bf7cf02acaa5bc5672cc90c8bb805336
parent e1b17520
......@@ -475,7 +475,8 @@ vmod_regex_foreach(VRT_CTX, struct vmod_re_regex *re, VCL_STRING subject,
return (0);
ov = (ov_t *) task->priv;
while (match(ctx, re->vre, subject, PCRE2_ZERO_TERMINATED,
while (! VRT_handled(ctx) &&
match(ctx, re->vre, subject, PCRE2_ZERO_TERMINATED,
ov->ovector[1], 0,
task, get_limits(re, &buf, limit, limit_recursion))
> PCRE2_ERROR_NOMATCH)
......@@ -786,7 +787,8 @@ foreach_iter_f(void *priv, unsigned flush, const void *ptr, ssize_t len)
#endif
i = reip_iter(reip, flush, ptr, len);
while (i == 0 && reip->s > PCRE2_ERROR_NOMATCH) {
while (i == 0 && reip->s > PCRE2_ERROR_NOMATCH &&
! VRT_handled(reip->ctx)) {
VRT_call(reip->ctx, reip->sub);
i = reip_iter(reip, flush, ptr, len);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment