[master] 6bec2c8 Fix a buglet in handling non-ascii strings in VCL, now that we (I) have decided what the strategy is going to be for synthetic in the future.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Jan 9 16:22:31 CET 2012
commit 6bec2c8361f4bb87e84e7760d0970f3d96e9d07f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jan 9 15:21:35 2012 +0000
Fix a buglet in handling non-ascii strings in VCL, now that we (I)
have decided what the strategy is going to be for synthetic in
the future.
Fixes #545
diff --git a/bin/varnishtest/tests/r00545.vtc b/bin/varnishtest/tests/r00545.vtc
new file mode 100644
index 0000000..0888af1
--- /dev/null
+++ b/bin/varnishtest/tests/r00545.vtc
@@ -0,0 +1,18 @@
+varnishtest "High-bit chars"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_deliver {
+ set resp.http.foo = "æøå";
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.http.foo == "æøå"
+} -run
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index fddd019..27447fe 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -229,7 +229,7 @@ EncString(struct vsb *sb, const char *b, const char *e, int mode)
if (isgraph(*b))
VSB_printf(sb, "%c", *b);
else
- VSB_printf(sb, "\\%03o", *b);
+ VSB_printf(sb, "\\%03o", (uint8_t)*b);
break;
}
}
@@ -241,7 +241,7 @@ EncToken(struct vsb *sb, const struct token *t)
{
assert(t->tok == CSTR);
- EncString(sb, t->dec, NULL, 0);
+ EncString(sb, t->dec, NULL, 1);
}
/*--------------------------------------------------------------------
More information about the varnish-commit
mailing list