Commit 4db1e7a8 authored by Geoff Simmons's avatar Geoff Simmons

rename the VMOD to blobcode

parent 4a68e274
......@@ -5,14 +5,14 @@ SUBDIRS = src
DISTCHECK_CONFIGURE_FLAGS = \
VMOD_DIR='$${libdir}/varnish/vmods'
EXTRA_DIST = README.rst LICENSE vmod-convert.spec debian
EXTRA_DIST = README.rst LICENSE vmod-blobcode.spec debian
doc_DATA = README.rst LICENSE
dist_man_MANS = vmod_convert.3
dist_man_MANS = vmod_blobcode.3
MAINTAINERCLEANFILES = $(dist_man_MANS)
vmod_convert.3: README.rst
vmod_blobcode.3: README.rst
%.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9:
if HAVE_RST2MAN
......
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2011-2015 Varnish Software AS])
AC_INIT([libvmod-convert], [trunk])
AC_INIT([libvmod-blobcode], [trunk])
AC_CONFIG_MACRO_DIR([m4])
m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
AC_CONFIG_SRCDIR(src/vmod_convert.vcc)
AC_CONFIG_SRCDIR(src/vmod_blobcode.vcc)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
......
AM_CPPFLAGS = @VMOD_INCLUDES@ -Wall -Werror
vmoddir = @VMOD_DIR@
vmod_LTLIBRARIES = libvmod_convert.la
vmod_LTLIBRARIES = libvmod_blobcode.la
libvmod_convert_la_LDFLAGS = -module -export-dynamic -avoid-version -shared
libvmod_blobcode_la_LDFLAGS = -module -export-dynamic -avoid-version -shared
libvmod_convert_la_SOURCES = \
vmod_convert.c \
vmod_convert.h \
libvmod_blobcode_la_SOURCES = \
vmod_blobcode.c \
vmod_blobcode.h \
id.c \
base64.c \
hex.c
nodist_libvmod_convert_la_SOURCES = \
nodist_libvmod_blobcode_la_SOURCES = \
vcc_if.c \
vcc_if.h \
parse_encoding.h \
......@@ -25,30 +25,30 @@ parse_encoding.h: parse_encoding.c
parse_encoding.c: gen_enum_parse.pl
$(srcdir)/gen_enum_parse.pl parse_encoding.c parse_encoding.h
vmod_convert.lo: vcc_if.c vcc_if.h
vmod_blobcode.lo: vcc_if.c vcc_if.h
vcc_if.c: vcc_if.h
vcc_if.h: @VMODTOOL@ $(top_srcdir)/src/vmod_convert.vcc
@VMODTOOL@ $(top_srcdir)/src/vmod_convert.vcc
vcc_if.h: @VMODTOOL@ $(top_srcdir)/src/vmod_blobcode.vcc
@VMODTOOL@ $(top_srcdir)/src/vmod_blobcode.vcc
VMOD_TESTS = $(top_srcdir)/src/tests/*.vtc
.PHONY: $(VMOD_TESTS)
$(top_srcdir)/src/tests/*.vtc: libvmod_convert.la
$(top_srcdir)/src/tests/*.vtc: libvmod_blobcode.la
@VARNISHTEST@ -Dvarnishd=@VARNISHD@ -Dvmod_topbuild=$(abs_top_builddir) $@
check: $(VMOD_TESTS)
EXTRA_DIST = \
gen_enum_parse.pl \
vmod_convert.vcc \
vmod_blobcode.vcc \
$(VMOD_TESTS)
CLEANFILES = \
$(builddir)/vcc_if.c \
$(builddir)/vcc_if.h \
$(builddir)/vmod_convert.rst \
$(builddir)/vmod_convert.man.rst \
$(builddir)/vmod_blobcode.rst \
$(builddir)/vmod_blobcode.man.rst \
$(builddir)/parse_encoding.h \
$(builddir)/parse_encoding.c
......@@ -28,7 +28,7 @@
#include <errno.h>
#include "vmod_convert.h"
#include "vmod_blobcode.h"
#include "vrt.h"
#include "vas.h"
......
......@@ -30,7 +30,7 @@
#include <errno.h>
#include <stdint.h>
#include "vmod_convert.h"
#include "vmod_blobcode.h"
#include "vrt.h"
#include "vas.h"
......
......@@ -29,7 +29,7 @@
#include <string.h>
#include <errno.h>
#include "vmod_convert.h"
#include "vmod_blobcode.h"
#include "vrt.h"
#include "vas.h"
......
This diff is collapsed.
......@@ -5,29 +5,29 @@ varnishtest "blob object interface"
server s1 {} -start
varnish v1 -arg "-i serverid" -vcl+backend {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
sub vcl_init {
new id = convert.blob(IDENTITY,
"The quick brown fox jumps over the lazy dog");
new id = blobcode.blob(IDENTITY,
"The quick brown fox jumps over the lazy dog");
new idpieces
= convert.blob(IDENTITY, "" + server.identity + " "
+ server.identity + "");
new idempty = convert.blob(IDENTITY, "");
= blobcode.blob(IDENTITY, "" + server.identity + " "
+ server.identity + "");
new idempty = blobcode.blob(IDENTITY, "");
new idparam
= convert.blob(encoded="" + server.identity + " " + server.identity
+ "", decoding=IDENTITY);
= blobcode.blob(encoded="" + server.identity + " " + server.identity
+ "", decoding=IDENTITY);
new hexuc = convert.blob(HEX, "666F6F206261722062617A2071757578");
new hexlc = convert.blob(HEX, "666f6f206261722062617a2071757578");
new hexmix = convert.blob(HEX, "666F6F206261722062617a2071757578");
new hexuc = blobcode.blob(HEX, "666F6F206261722062617A2071757578");
new hexlc = blobcode.blob(HEX, "666f6f206261722062617a2071757578");
new hexmix = blobcode.blob(HEX, "666F6F206261722062617a2071757578");
new b64 = convert.blob(BASE64, "L0hlbGxvIHdvcmxkLw==");
new b64 = blobcode.blob(BASE64, "L0hlbGxvIHdvcmxkLw==");
new b64nopad = convert.blob(BASE64URLNOPAD, "L0hlbGxvIHdvcmxkLw");
new b64nopad = blobcode.blob(BASE64URLNOPAD, "L0hlbGxvIHdvcmxkLw");
new hexall = convert.blob(HEX, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF");
new b64all = convert.blob(BASE64, "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==");
new hexall = blobcode.blob(HEX, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF");
new b64all = blobcode.blob(BASE64, "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==");
}
sub vcl_recv {
......@@ -35,20 +35,20 @@ varnish v1 -arg "-i serverid" -vcl+backend {
}
sub vcl_synth {
set resp.http.id = convert.encode(IDENTITY, id.get());
set resp.http.idpieces = convert.encode(IDENTITY, idpieces.get());
set resp.http.idparam = convert.encode(IDENTITY, idparam.get());
set resp.http.idempty = convert.encode(IDENTITY, idempty.get());
set resp.http.hexuc = convert.encode(IDENTITY, hexuc.get());
set resp.http.hexlc = convert.encode(IDENTITY, hexlc.get());
set resp.http.hexmix = convert.encode(IDENTITY, hexmix.get());
set resp.http.b64 = convert.encode(IDENTITY, b64.get());
set resp.http.b64nopad = convert.encode(IDENTITY, b64nopad.get());
set resp.http.allhex2b64func = convert.encode(BASE64,
hexall.get());
set resp.http.allb642hexlcfunc = convert.encode(HEXLC,
b64all.get());
set resp.http.id = blobcode.encode(IDENTITY, id.get());
set resp.http.idpieces = blobcode.encode(IDENTITY, idpieces.get());
set resp.http.idparam = blobcode.encode(IDENTITY, idparam.get());
set resp.http.idempty = blobcode.encode(IDENTITY, idempty.get());
set resp.http.hexuc = blobcode.encode(IDENTITY, hexuc.get());
set resp.http.hexlc = blobcode.encode(IDENTITY, hexlc.get());
set resp.http.hexmix = blobcode.encode(IDENTITY, hexmix.get());
set resp.http.b64 = blobcode.encode(IDENTITY, b64.get());
set resp.http.b64nopad = blobcode.encode(IDENTITY, b64nopad.get());
set resp.http.allhex2b64func = blobcode.encode(BASE64,
hexall.get());
set resp.http.allb642hexlcfunc = blobcode.encode(HEXLC,
b64all.get());
set resp.http.allhex2b64meth = hexall.encode(BASE64);
set resp.http.allb642hexlcmeth = b64all.encode(HEXLC);
......@@ -133,12 +133,12 @@ client c1 {
client c1 -run
varnish v1 -vcl+backend {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
sub vcl_init {
new b64 = convert.blob(BASE64, "L0hlbGxvIHdvcmxkLw==");
new b64url = convert.blob(BASE64URL, "L0hlbGxvIHdvcmxkLw==");
new b64nopad = convert.blob(BASE64URLNOPAD, "L0hlbGxvIHdvcmxkLw");
new b64 = blobcode.blob(BASE64, "L0hlbGxvIHdvcmxkLw==");
new b64url = blobcode.blob(BASE64URL, "L0hlbGxvIHdvcmxkLw==");
new b64nopad = blobcode.blob(BASE64URLNOPAD, "L0hlbGxvIHdvcmxkLw");
}
sub vcl_recv {
......@@ -197,34 +197,34 @@ client c2 {
# run twice
client c2 -run
varnish v1 -errvcl {vmod convert error: cannot create blob err, illegal encoding beginning with "g"} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: cannot create blob err, illegal encoding beginning with "g"} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new err = convert.blob(HEX, "g");
new err = blobcode.blob(HEX, "g");
}
}
varnish v1 -errvcl {vmod convert error: cannot create blob bad64, illegal encoding beginning with "-_-_"} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: cannot create blob bad64, illegal encoding beginning with "-_-_"} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new bad64 = convert.blob(BASE64, "-_-_");
new bad64 = blobcode.blob(BASE64, "-_-_");
}
}
varnish v1 -errvcl {vmod convert error: cannot create blob badurl, illegal encoding beginning with "+/+/"} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: cannot create blob badurl, illegal encoding beginning with "+/+/"} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new badurl = convert.blob(BASE64URL, "+/+/");
new badurl = blobcode.blob(BASE64URL, "+/+/");
}
}
varnish v1 -errvcl {vmod convert error: cannot create blob badpad, illegal encoding beginning with "YWI="} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: cannot create blob badpad, illegal encoding beginning with "YWI="} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new badpad = convert.blob(BASE64URLNOPAD, "YWI=");
new badpad = blobcode.blob(BASE64URLNOPAD, "YWI=");
}
}
......@@ -3,7 +3,7 @@
varnishtest "hex encode and decode"
varnish v1 -vcl {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
import ${vmod_std};
backend b { .host = "${bad_ip}"; }
......@@ -20,35 +20,37 @@ varnish v1 -vcl {
{"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="};
set resp.http.hexlc =
convert.encode(HEXLC, convert.decode(IDENTITY, req.http.pangram));
blobcode.encode(HEXLC,
blobcode.decode(IDENTITY, req.http.pangram));
set resp.http.hexuc =
convert.encode(HEXUC, convert.decode(IDENTITY, req.http.pangram));
blobcode.encode(HEXUC,
blobcode.decode(IDENTITY, req.http.pangram));
set resp.http.hobbeslc =
convert.encode(HEXLC, convert.decode(IDENTITY, req.http.hobbes));
blobcode.encode(HEXLC, blobcode.decode(IDENTITY, req.http.hobbes));
set resp.http.hobbesuc =
convert.encode(HEXUC, convert.decode(IDENTITY, req.http.hobbes));
blobcode.encode(HEXUC, blobcode.decode(IDENTITY, req.http.hobbes));
set resp.http.all-lc =
convert.encode(HEXLC, convert.decode(BASE64, req.http.b64all));
blobcode.encode(HEXLC, blobcode.decode(BASE64, req.http.b64all));
set resp.http.all-uc =
convert.encode(HEXUC, convert.decode(BASE64, req.http.b64all));
blobcode.encode(HEXUC, blobcode.decode(BASE64, req.http.b64all));
set resp.http.empty-lc =
convert.encode(HEXLC, convert.decode(IDENTITY, ""));
blobcode.encode(HEXLC, blobcode.decode(IDENTITY, ""));
set resp.http.empty-uc =
convert.encode(HEXUC, convert.decode(IDENTITY, ""));
blobcode.encode(HEXUC, blobcode.decode(IDENTITY, ""));
set resp.http.hexlcparam =
convert.encode(blob=convert.decode(IDENTITY, req.http.pangram),
blobcode.encode(blob=blobcode.decode(IDENTITY, req.http.pangram),
encoding=HEXLC);
set resp.http.hexucparam =
convert.encode(blob=convert.decode(IDENTITY, req.http.pangram),
blobcode.encode(blob=blobcode.decode(IDENTITY, req.http.pangram),
encoding=HEXUC);
set req.http.hexucfoobar = "666F6F206261722062617A2071757578";
......@@ -62,69 +64,71 @@ varnish v1 -vcl {
set req.http.hexalllcodd = regsub(req.http.hexalllc, "^0", "");
set resp.http.decuc =
convert.encode(IDENTITY,
convert.decode(HEX, req.http.hexucfoobar));
blobcode.encode(IDENTITY,
blobcode.decode(HEX, req.http.hexucfoobar));
set resp.http.declc =
convert.encode(IDENTITY,
convert.decode(HEX, req.http.hexlcfoobar));
blobcode.encode(IDENTITY,
blobcode.decode(HEX, req.http.hexlcfoobar));
set resp.http.dechobbesuc =
convert.encode(IDENTITY,
convert.decode(HEX, req.http.hexhobbesuc));
blobcode.encode(IDENTITY,
blobcode.decode(HEX, req.http.hexhobbesuc));
set resp.http.dechobbeslc =
convert.encode(IDENTITY,
convert.decode(HEX, req.http.hexhobbeslc));
blobcode.encode(IDENTITY,
blobcode.decode(HEX, req.http.hexhobbeslc));
set resp.http.decalluc =
convert.encode(BASE64, convert.decode(HEX, req.http.hexalluc));
blobcode.encode(BASE64, blobcode.decode(HEX, req.http.hexalluc));
set resp.http.decalllc =
convert.encode(BASE64, convert.decode(HEX, req.http.hexalllc));
blobcode.encode(BASE64, blobcode.decode(HEX, req.http.hexalllc));
set resp.http.decallucodd =
convert.encode(BASE64, convert.decode(HEX, req.http.hexallucodd));
blobcode.encode(BASE64, blobcode.decode(HEX,
req.http.hexallucodd));
set resp.http.decalllcodd =
convert.encode(BASE64, convert.decode(HEX, req.http.hexalllcodd));
blobcode.encode(BASE64, blobcode.decode(HEX,
req.http.hexalllcodd));
set resp.http.decempty =
convert.encode(IDENTITY, convert.decode(HEX, ""));
blobcode.encode(IDENTITY, blobcode.decode(HEX, ""));
set resp.http.decemptybyte =
convert.encode(IDENTITY, convert.decode(HEX, "00"));
blobcode.encode(IDENTITY, blobcode.decode(HEX, "00"));
set resp.http.decemptynibble =
convert.encode(IDENTITY, convert.decode(HEX, "0"));
blobcode.encode(IDENTITY, blobcode.decode(HEX, "0"));
set resp.http.decemptypieces =
convert.encode(IDENTITY,
convert.decode(HEX, req.http.unset + ""
blobcode.encode(IDENTITY,
blobcode.decode(HEX, req.http.unset + ""
+ req.http.unset + ""));
set req.http.part1 = "666";
set resp.http.dec2pieces =
convert.encode(IDENTITY, convert.decode(HEX, req.http.part1 +
blobcode.encode(IDENTITY, blobcode.decode(HEX, req.http.part1 +
"F6F206261722062617A2071757578"));
set req.http.part2 = "57578";
set resp.http.dec3param =
convert.encode(blob=convert.decode(encoded=req.http.part1 +
blobcode.encode(blob=blobcode.decode(encoded=req.http.part1 +
"F6F206261722062617A20717" + req.http.part2,
decoding=HEX),
encoding=IDENTITY);
set resp.http.dec3pieces =
convert.encode(IDENTITY, convert.decode(HEX, req.http.part1 +
blobcode.encode(IDENTITY, blobcode.decode(HEX, req.http.part1 +
"F6F206261722062617A20717" + req.http.part2));
set resp.http.decmanypieces =
convert.encode(IDENTITY, convert.decode(HEX, "" + req.http.unset +
req.http.part1 + req.http.unset + "" +
req.http.unset + "" + "F6F206261722062617A20717" +
"" + req.http.unset + req.http.part2 +
req.http.unset + "" + req.http.unset));
blobcode.encode(IDENTITY, blobcode.decode(HEX, "" + req.http.unset
+ req.http.part1 + req.http.unset + ""
+ req.http.unset + "" + "F6F206261722062617A20717"
+ "" + req.http.unset + req.http.part2
+ req.http.unset + "" + req.http.unset));
}
} -start
......@@ -160,7 +164,7 @@ client c1 {
} -run
varnish v1 -vcl {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host = "${bad_ip}"; }
sub vcl_recv {
......@@ -169,8 +173,8 @@ varnish v1 -vcl {
sub vcl_synth {
set req.http.foo = "123";
set resp.http.badhex = convert.encode(HEXUC,
convert.decode(HEX, "g" + req.http.foo));
set resp.http.badhex = blobcode.encode(HEXUC,
blobcode.decode(HEX, "g" + req.http.foo));
}
}
......@@ -182,7 +186,7 @@ client c1 {
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"g\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"g\"$"
#"
expect * = End
} -start
......
......@@ -3,7 +3,7 @@
varnishtest "IDENTITY encode and decode"
varnish v1 -vcl {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host = "${bad_ip}"; }
sub vcl_recv {
......@@ -12,45 +12,45 @@ varnish v1 -vcl {
sub vcl_synth {
set resp.http.id =
convert.encode(IDENTITY, convert.decode(IDENTITY,
"The quick brown fox jumps over the lazy dog"));
blobcode.encode(IDENTITY, blobcode.decode(IDENTITY,
"The quick brown fox jumps over the lazy dog"));
set resp.http.hobbes =
convert.encode(IDENTITY, convert.decode(IDENTITY,
blobcode.encode(IDENTITY, blobcode.decode(IDENTITY,
{"Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."}));
set resp.http.list =
convert.encode(IDENTITY, convert.decode(IDENTITY,
"" + req.http.unset + req.url +
"The quick brown fox jumps over " +
req.http.unset + "" + req.http.unset + "" +
"the lazy dog" + req.url + req.http.unset + ""));
blobcode.encode(IDENTITY, blobcode.decode(IDENTITY,
"" + req.http.unset + req.url +
"The quick brown fox jumps over " +
req.http.unset + "" + req.http.unset + "" +
"the lazy dog" + req.url + req.http.unset + ""));
set resp.http.empty =
convert.encode(IDENTITY, convert.decode(IDENTITY, ""));
blobcode.encode(IDENTITY, blobcode.decode(IDENTITY, ""));
set resp.http.undef =
convert.encode(IDENTITY, convert.decode(IDENTITY,
blobcode.encode(IDENTITY, blobcode.decode(IDENTITY,
req.http.unset));
set resp.http.emptylist =
convert.encode(IDENTITY, convert.decode(IDENTITY,
req.http.unset + "" + req.http.unset + ""));
blobcode.encode(IDENTITY, blobcode.decode(IDENTITY,
req.http.unset + "" + req.http.unset + ""));
set resp.http.param =
convert.encode(blob=
convert.decode(encoded=
blobcode.encode(blob=
blobcode.decode(encoded=
"The quick brown fox jumps over the lazy dog",
decoding=IDENTITY),
encoding=IDENTITY);
encoding=IDENTITY);
set resp.http.paramlist =
convert.encode(IDENTITY, convert.decode(encoded=
"" + req.http.unset + req.url +
"The quick brown fox jumps over " +
req.http.unset + "" + req.http.unset + "" +
"the lazy dog" + req.url + req.http.unset + "",
decoding=IDENTITY));
blobcode.encode(IDENTITY, blobcode.decode(encoded=
"" + req.http.unset + req.url +
"The quick brown fox jumps over " +
req.http.unset + "" + req.http.unset + "" +
"the lazy dog" + req.url + req.http.unset + "",
decoding=IDENTITY));
}
} -start
......@@ -66,6 +66,4 @@ client c1 {
expect resp.http.emptylist == ""
expect resp.http.param == "The quick brown fox jumps over the lazy dog"
expect resp.http.paramlist == "/The quick brown fox jumps over the lazy dog/"
}
client c1 -run
} -run
......@@ -4,109 +4,108 @@ varnishtest "test permitted use of functions in vcl_subs"
varnish v1 -vcl { backend b { .host="${bad_ip}"; } } -start
varnish v1 -errvcl {vmod convert error: decode() is illegal in vcl_init() and vcl_fini().vmod convert error: encode() is illegal in vcl_init() and vcl_fini().} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: decode() is illegal in vcl_init() and vcl_fini().vmod blobcode error: encode() is illegal in vcl_init() and vcl_fini().} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new err = convert.blob(IDENTITY,
convert.encode(IDENTITY,
convert.decode(IDENTITY, "x")));
new err = blobcode.blob(IDENTITY, blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "x")));
}
}
varnish v1 -errvcl {vmod convert error: transcode() is illegal in vcl_init() and vcl_fini().} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: transcode() is illegal in vcl_init() and vcl_fini().} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new err = convert.blob(IDENTITY,
convert.transcode(IDENTITY, IDENTITY, "x"));
new err = blobcode.blob(IDENTITY,
blobcode.transcode(IDENTITY, IDENTITY, "x"));
}
}
varnish v1 -errvcl {vmod convert error: encode() is illegal in vcl_init() and vcl_fini().} {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
varnish v1 -errvcl {vmod blobcode error: encode() is illegal in vcl_init() and vcl_fini().} {
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_init {
new b1 = convert.blob(IDENTITY, "foo");
new b2 = convert.blob(IDENTITY, convert.encode(IDENTITY, b1.get()));
new b1 = blobcode.blob(IDENTITY, "foo");
new b2 = blobcode.blob(IDENTITY, blobcode.encode(IDENTITY, b1.get()));
}
}
# The *code() functions are legal in every other VCL sub
varnish v1 -vcl {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
backend b { .host="${bad_ip}"; }
sub vcl_recv {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_pipe {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_pass {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_hash {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_miss {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_hit {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_purge {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_deliver {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_synth {
set req.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set req.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set req.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set req.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_backend_fetch {
set bereq.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set bereq.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set bereq.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set bereq.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_backend_response {
set bereq.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set bereq.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set bereq.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set bereq.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
sub vcl_backend_error {
set bereq.http.x = convert.encode(IDENTITY,
convert.decode(IDENTITY, "foo"));
set bereq.http.x = convert.transcode(IDENTITY, IDENTITY, "foo");
set bereq.http.x = blobcode.encode(IDENTITY,
blobcode.decode(IDENTITY, "foo"));
set bereq.http.x = blobcode.transcode(IDENTITY, IDENTITY, "foo");
}
}
......@@ -3,7 +3,7 @@
varnishtest "Test transcode()"
varnish v1 -vcl {
import convert from "${vmod_topbuild}/src/.libs/libvmod_convert.so";
import blobcode from "${vmod_topbuild}/src/.libs/libvmod_blobcode.so";
import ${vmod_std};
backend b { .host = "${bad_ip}"; }
......@@ -29,113 +29,113 @@ varnish v1 -vcl {
{"AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZaaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz0000111122223333444455556666777788889999----____"};
set resp.http.id2id
= convert.transcode(IDENTITY, IDENTITY, "Hello world");
= blobcode.transcode(IDENTITY, IDENTITY, "Hello world");
set resp.http.id2b64
= convert.transcode(IDENTITY, BASE64, req.http.hobbes);
= blobcode.transcode(IDENTITY, BASE64, req.http.hobbes);
set resp.http.id2b64nopad
= convert.transcode(IDENTITY, BASE64URLNOPAD, req.http.hobbes);
= blobcode.transcode(IDENTITY, BASE64URLNOPAD, req.http.hobbes);
set resp.http.id2hexuc
= convert.transcode(IDENTITY, HEXUC, req.http.hobbes);
= blobcode.transcode(IDENTITY, HEXUC, req.http.hobbes);
set resp.http.id2hexlc
= convert.transcode(IDENTITY, HEXLC, req.http.hobbes);
= blobcode.transcode(IDENTITY, HEXLC, req.http.hobbes);
set resp.http.b642id
= convert.transcode(BASE64, IDENTITY, req.http.hobbesb64);
= blobcode.transcode(BASE64, IDENTITY, req.http.hobbesb64);
set resp.http.hex2id
= convert.transcode(HEX, IDENTITY, req.http.hexhobbes);
= blobcode.transcode(HEX, IDENTITY, req.http.hexhobbes);
set resp.http.hexalldown2b64
= convert.transcode(HEX, BASE64, req.http.hexalldown);
= blobcode.transcode(HEX, BASE64, req.http.hexalldown);
set resp.http.hexalldown2b64url
= convert.transcode(HEX, BASE64URL, req.http.hexalldown);
= blobcode.transcode(HEX, BASE64URL, req.http.hexalldown);
set resp.http.hexalldown2b64nopad
= convert.transcode(HEX, BASE64URLNOPAD, req.http.hexalldown);
= blobcode.transcode(HEX, BASE64URLNOPAD, req.http.hexalldown);
set resp.http.hexallup2b64
= convert.transcode(HEX, BASE64, req.http.hexallup);
= blobcode.transcode(HEX, BASE64, req.http.hexallup);
set resp.http.hexallup2b64url
= convert.transcode(HEX, BASE64URL, req.http.hexallup);
= blobcode.transcode(HEX, BASE64URL, req.http.hexallup);
set resp.http.hexallup2b64nopad
= convert.transcode(HEX, BASE64URLNOPAD, req.http.hexallup);
= blobcode.transcode(HEX, BASE64URLNOPAD, req.http.hexallup);
set resp.http.b64all2hexuc
= convert.transcode(BASE64, HEXUC, req.http.b64all);
= blobcode.transcode(BASE64, HEXUC, req.http.b64all);
set resp.http.b64all2hexlc
= convert.transcode(BASE64, HEXLC, req.http.b64all);
= blobcode.transcode(BASE64, HEXLC, req.http.b64all);
set resp.http.b64allurl2hexuc
= convert.transcode(BASE64URL, HEXUC, req.http.b64allurl);
= blobcode.transcode(BASE64URL, HEXUC, req.http.b64allurl);
set resp.http.b64allurl2hexlc
= convert.transcode(BASE64URL, HEXLC, req.http.b64allurl);
= blobcode.transcode(BASE64URL, HEXLC, req.http.b64allurl);
set resp.http.hexuc2hexuc
= convert.transcode(HEX, HEXUC, "0123456789ABCDEF");
= blobcode.transcode(HEX, HEXUC, "0123456789ABCDEF");
set resp.http.hexlc2hexlc
= convert.transcode(HEX, HEXLC, "0123456789abcdef");
= blobcode.transcode(HEX, HEXLC, "0123456789abcdef");
set resp.http.hexuc2hexlc
= convert.transcode(HEX, HEXLC, "0123456789ABCDEF");
= blobcode.transcode(HEX, HEXLC, "0123456789ABCDEF");
set resp.http.hexlc2hexuc
= convert.transcode(HEX, HEXUC, "0123456789abcdef");
= blobcode.transcode(HEX, HEXUC, "0123456789abcdef");
set resp.http.hexmix2hexuc
= convert.transcode(HEX, HEXUC, "0123456789ABCdef");
= blobcode.transcode(HEX, HEXUC, "0123456789ABCdef");
set resp.http.hexmix2hexlc
= convert.transcode(HEX, HEXLC, "0123456789abcDEF");
= blobcode.transcode(HEX, HEXLC, "0123456789abcDEF");
set req.http.hexpart1 = "01234567";
set req.http.hexpart2 = "89abcdef";
set resp.http.hexparam
= convert.transcode(encoded="" + req.http.unset + ""
+ req.http.unset + "" + req.http.hexpart1
+ "" + req.http.unset + "" + req.http.unset
+ req.http.hexpart2, decoding=HEX,
encoding=HEXUC);
= blobcode.transcode(encoded="" + req.http.unset + ""
+ req.http.unset + "" + req.http.hexpart1
+ "" + req.http.unset + "" + req.http.unset
+ req.http.hexpart2, decoding=HEX,
encoding=HEXUC);
set resp.http.b642b64
= convert.transcode(BASE64, BASE64,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz0123456789+/");
= blobcode.transcode(BASE64, BASE64,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz0123456789+/");
set resp.http.b64url2b64url =
convert.transcode(BASE64URL, BASE64URL,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz0123456789-_");
blobcode.transcode(BASE64URL, BASE64URL,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz0123456789-_");
set resp.http.b64urlnopad2b64urlnopad =
convert.transcode(BASE64URLNOPAD, BASE64URLNOPAD,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz0123456789-_");
blobcode.transcode(BASE64URLNOPAD, BASE64URLNOPAD,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz0123456789-_");
set resp.http.badhex = convert.transcode(HEX, IDENTITY, "0x123456");
set resp.http.badhex = blobcode.transcode(HEX, IDENTITY, "0x123456");
set req.http.foo = "AAA=";
set resp.http.bad64 = convert.transcode(BASE64, IDENTITY,
"-_-_" + req.http.foo);
set resp.http.badurl = convert.transcode(BASE64URL, IDENTITY,
"+/+/" + req.http.foo);
set resp.http.badpad = convert.transcode(BASE64URLNOPAD, IDENTITY,
"TWFu" + req.http.foo);
set resp.http.bad64264 = convert.transcode(BASE64, BASE64,
"_-_-" + req.http.foo);
set resp.http.badurl2url = convert.transcode(BASE64URL, BASE64URL,
"/+/+" + req.http.foo);
set resp.http.bad64 = blobcode.transcode(BASE64, IDENTITY,
"-_-_" + req.http.foo);
set resp.http.badurl = blobcode.transcode(BASE64URL, IDENTITY,
"+/+/" + req.http.foo);
set resp.http.badpad = blobcode.transcode(BASE64URLNOPAD, IDENTITY,
"TWFu" + req.http.foo);
set resp.http.bad64264 = blobcode.transcode(BASE64, BASE64,
"_-_-" + req.http.foo);
set resp.http.badurl2url = blobcode.transcode(BASE64URL, BASE64URL,
"/+/+" + req.http.foo);
set resp.http.badpad2pad
= convert.transcode(BASE64URLNOPAD, BASE64URLNOPAD,
"Zm9v" + req.http.foo);
= blobcode.transcode(BASE64URLNOPAD, BASE64URLNOPAD,
"Zm9v" + req.http.foo);
}
} -start
......@@ -182,19 +182,19 @@ client c1 -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"0x123456\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"0x123456\"$"
#"
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"-_-_\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"-_-_\"$"
#"
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"\+/\+/\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"\+/\+/\"$"
#"
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"TWFu\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"TWFu\"$"
#"
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"_-_-\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"_-_-\"$"
#"
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"/\+/\+\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"/\+/\+\"$"
#"
expect * = VCL_Error "^vmod convert error: cannot decode, illegal encoding beginning with \"Zm9v\"$"
expect * = VCL_Error "^vmod blobcode error: cannot decode, illegal encoding beginning with \"Zm9v\"$"
#"
expect * = End
} -start
......
......@@ -33,22 +33,22 @@
#include "vrt.h"
#include "vcc_if.h"
#include "vmod_convert.h"
#include "vmod_blobcode.h"
#include "wb.h"
struct vmod_convert_blob {
struct vmod_blobcode_blob {
unsigned magic;
#define VMOD_CONVERT_BLOB_MAGIC 0xfade4fa9
#define VMOD_BLOBCODE_BLOB_MAGIC 0xfade4fa9
struct vmod_priv blob;
const char *encoding[__MAX_ENCODING];
pthread_mutex_t lock;
};
#define ERR(ctx, msg) \
errmsg((ctx), "vmod convert error: " msg)
errmsg((ctx), "vmod blobcode error: " msg)
#define VERR(ctx, fmt, ...) \
errmsg((ctx), "vmod convert error: " fmt, __VA_ARGS__)
errmsg((ctx), "vmod blobcode error: " fmt, __VA_ARGS__)
#define ERRINVAL(ctx, enc) \
VERR((ctx), "cannot decode, illegal encoding beginning with \"%s\"", \
......@@ -190,11 +190,11 @@ event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e event)
/* Objects */
VCL_VOID __match_proto__(td_convert_blob__init)
vmod_blob__init(VRT_CTX, struct vmod_convert_blob **blobp, const char *vcl_name,
VCL_VOID __match_proto__(td_blobcode_blob__init)
vmod_blob__init(VRT_CTX, struct vmod_blobcode_blob **blobp, const char *vcl_name,
VCL_ENUM decs, const char *p, ...)
{
struct vmod_convert_blob *b;
struct vmod_blobcode_blob *b;
enum encoding dec = parse_encoding(decs);
va_list ap;
ssize_t len;
......@@ -203,7 +203,7 @@ vmod_blob__init(VRT_CTX, struct vmod_convert_blob **blobp, const char *vcl_name,
AN(blobp);
AZ(*blobp);
AN(vcl_name);
ALLOC_OBJ(b, VMOD_CONVERT_BLOB_MAGIC);
ALLOC_OBJ(b, VMOD_BLOBCODE_BLOB_MAGIC);
AN(b);
*blobp = b;
b->blob.free = NULL;
......@@ -247,21 +247,21 @@ vmod_blob__init(VRT_CTX, struct vmod_convert_blob **blobp, const char *vcl_name,
b->blob.len = len;
}
VCL_BLOB __match_proto__(td_convert_blob_get)
vmod_blob_get(VRT_CTX, struct vmod_convert_blob *b)
VCL_BLOB __match_proto__(td_blobcode_blob_get)
vmod_blob_get(VRT_CTX, struct vmod_blobcode_blob *b)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(b, VMOD_CONVERT_BLOB_MAGIC);
CHECK_OBJ_NOTNULL(b, VMOD_BLOBCODE_BLOB_MAGIC);
return &b->blob;
}
VCL_STRING
vmod_blob_encode(VRT_CTX, struct vmod_convert_blob *b, VCL_ENUM encs)
vmod_blob_encode(VRT_CTX, struct vmod_blobcode_blob *b, VCL_ENUM encs)
{
enum encoding enc = parse_encoding(encs);
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(b, VMOD_CONVERT_BLOB_MAGIC);
CHECK_OBJ_NOTNULL(b, VMOD_BLOBCODE_BLOB_MAGIC);
if (b->blob.len == 0)
return "";
......@@ -313,15 +313,15 @@ vmod_blob_encode(VRT_CTX, struct vmod_convert_blob *b, VCL_ENUM encs)
return b->encoding[enc];
}
VCL_VOID __match_proto__(td_convert_blob__fini)
vmod_blob__fini(struct vmod_convert_blob **blobp)
VCL_VOID __match_proto__(td_blobcode_blob__fini)
vmod_blob__fini(struct vmod_blobcode_blob **blobp)
{
struct vmod_convert_blob *b;
struct vmod_blobcode_blob *b;
AN(*blobp);
b = *blobp;
*blobp = NULL;
CHECK_OBJ_NOTNULL(b, VMOD_CONVERT_BLOB_MAGIC);
CHECK_OBJ_NOTNULL(b, VMOD_BLOBCODE_BLOB_MAGIC);
if (b->blob.priv != NULL) {
free(b->blob.priv);
b->blob.priv = NULL;
......@@ -337,7 +337,7 @@ vmod_blob__fini(struct vmod_convert_blob **blobp)
/* Functions */
VCL_BLOB __match_proto__(td_convert_decode)
VCL_BLOB __match_proto__(td_blobcode_decode)
vmod_decode(VRT_CTX, VCL_ENUM decs, const char *p, ...) {
enum encoding dec = parse_encoding(decs);
va_list ap;
......@@ -388,7 +388,7 @@ vmod_decode(VRT_CTX, VCL_ENUM decs, const char *p, ...) {
return b;
}
VCL_STRING __match_proto__(td_convert_encode)
VCL_STRING __match_proto__(td_blobcode_encode)
vmod_encode(VRT_CTX, VCL_ENUM encs, VCL_BLOB b) {
enum encoding enc = parse_encoding(encs);
struct wb_s wb;
......@@ -423,7 +423,7 @@ vmod_encode(VRT_CTX, VCL_ENUM encs, VCL_BLOB b) {
return wb_finish(&wb, NULL);
}
VCL_STRING __match_proto__(td_convert_transcode)
VCL_STRING __match_proto__(td_blobcode_transcode)
vmod_transcode(VRT_CTX, VCL_ENUM decs, VCL_ENUM encs, const char *p, ...) {
enum encoding dec = parse_encoding(decs);
enum encoding enc = parse_encoding(encs);
......
......@@ -4,7 +4,7 @@
# (vmodtool requires this format.)
#
$Module convert 3 Convert between different encodings and strings/blobs
$Module blobcode 3 binary-to-text encodings and decodings for the VCL blob type
DESCRIPTION
===========
......
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