Mailing List Archive

[master] 0b374145f Add BLOB to STRING folder, using Structured Fields (upcoming RFC):
commit 0b374145f5bf8ce9fe83abfd797bba0b6312ed54
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Fri Aug 7 08:34:37 2020 +0000

Add BLOB to STRING folder, using Structured Fields (upcoming RFC):

':' base64(blob) ':'

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 4229d8e53..7da0734ab 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -39,6 +39,7 @@
#include "vav.h"
#include "vcl.h"
#include "vct.h"
+#include "venc.h"
#include "vend.h"
#include "vrt_obj.h"
#include "vsa.h"
@@ -759,6 +760,22 @@ VRT_BOOL_string(VCL_BOOL val)
return (val ? "true" : "false");
}

+VCL_STRING v_matchproto_()
+VRT_BLOB_string(VRT_CTX, VCL_BLOB val)
+{
+ struct vsb vsb[1];
+ const char *s;
+
+ if (val == NULL)
+ return (NULL);
+ WS_VSB_new(vsb, ctx->ws);
+ VSB_putc(vsb, ':');
+ VENC_Encode_Base64(vsb, val->blob, val->len);
+ VSB_putc(vsb, ':');
+ s = WS_VSB_finish(vsb, ctx->ws, NULL);
+ return (s);
+}
+
/*--------------------------------------------------------------------*/

VCL_VOID
diff --git a/lib/libvcc/vcc_types.c b/lib/libvcc/vcc_types.c
index dace016e9..576e55cee 100644
--- a/lib/libvcc/vcc_types.c
+++ b/lib/libvcc/vcc_types.c
@@ -76,6 +76,7 @@ const struct type BACKEND[1] = {{
const struct type BLOB[1] = {{
.magic = TYPE_MAGIC,
.name = "BLOB",
+ .tostring = "VRT_BLOB_string(ctx, \v1)",
}};

const struct type BODY[1] = {{
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit