Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobcode
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-blobcode
Commits
ef057b6d
Commit
ef057b6d
authored
Jan 27, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
used named parameters in the VMOD interface
parent
5c8c5a2a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
4 deletions
+81
-4
base64.vtc
src/tests/base64.vtc
+25
-0
blob.vtc
src/tests/blob.vtc
+5
-0
hex.vtc
src/tests/hex.vtc
+19
-0
id.vtc
src/tests/id.vtc
+18
-0
xcode.vtc
src/tests/xcode.vtc
+10
-0
vmod_convert.vcc
src/vmod_convert.vcc
+4
-4
No files found.
src/tests/base64.vtc
View file @
ef057b6d
...
...
@@ -24,6 +24,21 @@ varnish v1 -vcl+backend {
convert
.
encode
(
BASE64URLNOPAD
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
b64param
=
convert
.
encode
(
blob
=
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
),
encoding
=
BASE64
);
set
resp
.
http
.
b64urlparam
=
convert
.
encode
(
blob
=
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
),
encoding
=
BASE64URL
);
set
resp
.
http
.
b64urlnopadparam
=
convert
.
encode
(
blob
=
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
),
encoding
=
BASE64URLNOPAD
);
set
resp
.
http
.
b64xcode
=
convert
.
transcode
(
IDENTITY
,
BASE64
,
req
.
url
+
"Hello world"
+
req
.
url
);
...
...
@@ -68,6 +83,12 @@ varnish v1 -vcl+backend {
+
"H"
+
resp
.
http
.
mid2
+
"kLw"
+
resp
.
http
.
pad
));
set
resp
.
http
.
dec7param
=
convert
.
encode
(
blob
=
convert
.
decode
(
encoded
=
resp
.
http
.
l
+
"0hlb"
+
resp
.
http
.
mid1 + "H" + resp.http.mid
2
+
"kLw"
+
resp
.
http
.
pad
,
decoding
=
BASE64
),
encoding
=
IDENTITY
);
set
resp
.
http
.
decnopad
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
BASE64URLNOPAD
,
"L0hlbGxvIHdvcmxkLw"
));
...
...
@@ -96,6 +117,9 @@ client c1 {
expect
resp
.
http
.
b64
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw=="
expect
resp
.
http
.
b64url
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw=="
expect
resp
.
http
.
b64urlnopad
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
expect
resp
.
http
.
b64param
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw=="
expect
resp
.
http
.
b64urlparam
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw=="
expect
resp
.
http
.
b64urlnopadparam
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
expect
resp
.
http
.
b64xcode
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
b64urlxcode
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
b64urlnopadxcode
==
"L0hlbGxvIHdvcmxkLw"
...
...
@@ -105,6 +129,7 @@ client c1 {
expect
resp
.
http
.
dec2pieces
==
"/Hello world/"
expect
resp
.
http
.
dec3pieces
==
"/Hello world/"
expect
resp
.
http
.
dec7pieces
==
"/Hello world/"
expect
resp
.
http
.
dec7param
==
"/Hello world/"
expect
resp
.
http
.
decnopad
==
"/Hello world/"
expect
resp
.
http
.
decnopad2pieces
==
"/Hello world/"
expect
resp
.
http
.
decnopad6pieces
==
"/Hello world/"
...
...
src/tests/blob.vtc
View file @
ef057b6d
...
...
@@ -14,6 +14,9 @@ varnish v1 -arg "-i serverid" -vcl+backend {
=
convert
.
blob
(
IDENTITY
,
""
+
server
.
identity
+
" "
+
server
.
identity
+
""
);
new
idempty
=
convert
.
blob
(
IDENTITY
,
""
);
new
idparam
=
convert
.
blob
(
encoded
=
""
+
server
.
identity
+
" "
+
server
.
identity
+
""
,
decoding
=
IDENTITY
);
new
hexuc
=
convert
.
blob
(
HEX
,
"666F6F206261722062617A2071757578"
);
new
hexlc
=
convert
.
blob
(
HEX
,
"666f6f206261722062617a2071757578"
);
...
...
@@ -31,6 +34,7 @@ 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
());
...
...
@@ -45,6 +49,7 @@ client c1 {
rxresp
expect
resp
.
http
.
id
==
"The quick brown fox jumps over the lazy dog"
expect
resp
.
http
.
idpieces
==
"serverid serverid"
expect
resp
.
http
.
idparam
==
"serverid serverid"
expect
resp
.
http
.
idempty
==
""
expect
resp
.
http
.
hexuc
==
"foo bar baz quux"
expect
resp
.
http
.
hexlc
==
"foo bar baz quux"
...
...
src/tests/hex.vtc
View file @
ef057b6d
...
...
@@ -20,6 +20,16 @@ varnish v1 -vcl+backend {
convert
.
encode
(
HEXUC
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
hexlcparam
=
convert
.
encode
(
blob
=
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
),
encoding
=
HEXLC
);
set
resp
.
http
.
hexucparam
=
convert
.
encode
(
blob
=
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
),
encoding
=
HEXUC
);
set
resp
.
http
.
decuc
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
HEX
,
"666F6F206261722062617A2071757578"
));
...
...
@@ -43,6 +53,12 @@ varnish v1 -vcl+backend {
"F6F206261722062617A2071757578"
));
set
req
.
http
.
part2
=
"57578"
;
set
resp
.
http
.
dec3param
=
convert
.
encode
(
blob
=
convert
.
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
+
"F6F206261722062617A20717"
+
req
.
http
.
part2
));
...
...
@@ -71,6 +87,8 @@ client c1 {
rxresp
expect
resp
.
http
.
hexlc
==
"54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67"
expect
resp
.
http
.
hexuc
==
"54686520717569636B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920646F67"
expect
resp
.
http
.
hexlcparam
==
"54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67"
expect
resp
.
http
.
hexucparam
==
"54686520717569636B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920646F67"
expect
resp
.
http
.
decuc
==
"foo bar baz quux"
expect
resp
.
http
.
declc
==
"foo bar baz quux"
expect
resp
.
http
.
decempty
==
""
...
...
@@ -78,6 +96,7 @@ client c1 {
expect
resp
.
http
.
decempty1byte
==
""
expect
resp
.
http
.
dec2pieces
==
"foo bar baz quux"
expect
resp
.
http
.
dec3pieces
==
"foo bar baz quux"
expect
resp
.
http
.
dec3param
==
"foo bar baz quux"
expect
resp
.
http
.
decmanypieces
==
"foo bar baz quux"
expect
resp
.
http
.
hexlcxcode
==
"2f48656c6c6f20776f726c642f"
expect
resp
.
http
.
hexucxcode
==
"2F48656C6C6F20776F726C642F"
...
...
src/tests/id.vtc
View file @
ef057b6d
...
...
@@ -33,6 +33,22 @@ varnish v1 -vcl+backend {
set
resp
.
http
.
emptylist
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
req
.
http
.
unset
+
""
+
req
.
http
.
unset
+
""
));
set
resp
.
http
.
param
=
convert
.
encode
(
blob
=
convert
.
decode
(
encoded
=
"The quick brown fox jumps over the lazy dog"
,
decoding
=
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
));
}
}
-
start
...
...
@@ -44,6 +60,8 @@ client c1 {
expect
resp
.
http
.
empty
==
""
expect
resp
.
http
.
undef
==
""
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
src/tests/xcode.vtc
View file @
ef057b6d
...
...
@@ -33,6 +33,15 @@ varnish v1 -vcl+backend {
set
resp
.
http
.
hexmix2hexlc
=
convert
.
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
);
set
resp
.
http
.
b642b64
=
convert
.
transcode
(
BASE64
,
BASE64
,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
...
...
@@ -76,6 +85,7 @@ client c1 {
expect
resp
.
http
.
hexlc2hexuc
==
"0123456789ABCDEF"
expect
resp
.
http
.
hexmix2hexuc
==
"0123456789ABCDEF"
expect
resp
.
http
.
hexmix2hexlc
==
"0123456789abcdef"
expect
resp
.
http
.
hexparam
==
"0123456789ABCDEF"
expect
resp
.
http
.
b642b64
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
expect
resp
.
http
.
b64url2b64url
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
expect
resp
.
http
.
b64urlnopad2b64urlnopad
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
...
...
src/vmod_convert.vcc
View file @
ef057b6d
...
...
@@ -14,15 +14,15 @@ XXX gen ENUMs
$Event event
$Object blob(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}
, STRING_LIST
)
$Object blob(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}
decoding, STRING_LIST encoded
)
$Method BLOB .get()
$Function BLOB decode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}
, STRING_LIST
)
$Function BLOB decode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}
decoding, STRING_LIST encoded
)
XXX DOC
$Function STRING encode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXUC, HEXLC}
, BLOB
)
$Function STRING encode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXUC, HEXLC}
encoding, BLOB blob
)
XXX DOC
$Function STRING transcode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}
, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXUC, HEXLC}, STRING_LIST
)
$Function STRING transcode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}
decoding, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXUC, HEXLC} encoding, STRING_LIST encoded
)
XXX DOC
REQUIREMENTS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment