Mailing List Archive

[master] 8e6527302 vrt: Log the proper vre error message
commit 8e652730266386053f2838db890a5a764d0e9013
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date: Tue Aug 3 09:00:46 2021 +0200

vrt: Log the proper vre error message

diff --git a/bin/varnishd/cache/cache_vrt_re.c b/bin/varnishd/cache/cache_vrt_re.c
index 4fc352364..944a40bce 100644
--- a/bin/varnishd/cache/cache_vrt_re.c
+++ b/bin/varnishd/cache/cache_vrt_re.c
@@ -64,6 +64,8 @@ VPI_re_fini(vre_t *rep)
VCL_BOOL
VRT_re_match(VRT_CTX, const char *s, VCL_REGEX re)
{
+ struct vsb vsb[1];
+ char errbuf[VRE_ERROR_LEN];
int i;

CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
@@ -73,8 +75,13 @@ VRT_re_match(VRT_CTX, const char *s, VCL_REGEX re)
i = VRE_match(re, s, 0, 0, &cache_param->vre_limits);
if (i >= 0)
return (1);
- if (i < VRE_ERROR_NOMATCH )
- VRT_fail(ctx, "Regexp matching returned %d", i);
+ if (i < VRE_ERROR_NOMATCH ) {
+ VSB_init(vsb, errbuf, sizeof errbuf);
+ AZ(VRE_error(vsb, i));
+ AZ(VSB_finish(vsb));
+ VSB_fini(vsb);
+ VRT_fail(ctx, "Regexp matching failed: %s", errbuf);
+ }
return (0);
}

_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit