[master] 990095283 VSB_QUOTE_JSON does not produce JSON. Document what it does in the test

Nils Goroll nils.goroll at uplex.de
Fri Sep 1 09:23:09 UTC 2023


commit 9900952837dc96e61f9b00eb55b3f28f8ed8b83a
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Sep 1 11:21:02 2023 +0200

    VSB_QUOTE_JSON does not produce JSON. Document what it does in the test

diff --git a/lib/libvarnish/vsb_test.c b/lib/libvarnish/vsb_test.c
index b41512343..373e4bada 100644
--- a/lib/libvarnish/vsb_test.c
+++ b/lib/libvarnish/vsb_test.c
@@ -83,6 +83,24 @@ static struct tc tcs[] = {
 		5, "\x00\n\x7e\x7f\xff",
 		"PFX\"\\x00\\n\"\nPFX\"~\\x7f\\xff\"",
 	},
+	/*
+	 * VSB_QUOTE_JSON puts >0x7e literally
+	 */
+	{
+		VSB_QUOTE_JSON,
+		4, "\xf0\x9f\x90\xb0",
+		"PFX\xf0\x9f\x90\xb0",
+	},
+	/*
+	 * VSB_QUOTE_JSON encodes <0x20 as \u00XX, which looks like
+	 * unicode codepoints in the JSON standard, but are just
+	 * individual bytes
+	 */
+	{
+		VSB_QUOTE_JSON,
+		5, "\"\x01\x02\x03\x04",
+		"PFX\\\"\\u0001\\u0002\\u0003\\u0004",
+	},
 	{
 		VSB_QUOTE_JSON,
 		5, "\x00\n\x7e\x7f\xff",


More information about the varnish-commit mailing list