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
ae773ead
Commit
ae773ead
authored
Jan 11, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganize test cases
parent
f16546e7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
197 additions
and
0 deletions
+197
-0
base64.vtc
src/tests/base64.vtc
+52
-0
hex.vtc
src/tests/hex.vtc
+44
-0
id.vtc
src/tests/id.vtc
+49
-0
xcode.vtc
src/tests/xcode.vtc
+52
-0
No files found.
src/tests/
test01
.vtc
→
src/tests/
base64
.vtc
View file @
ae773ead
# looks like -*- perl -*-
varnishtest
"
Test convert vmod
"
varnishtest
"
base64 encode and decode
"
server
s1
{
rxreq
txresp
}
-
start
server
s1
{}
-
start
varnish
v1
-
vcl
+
backend
{
import
convert
from
"${vmod_topbuild}/src/.libs/libvmod_convert.so"
;
sub
vcl_deliver
{
set
resp
.
http
.
hexlcxcode
=
convert
.
transcode
(
IDENTITY
,
HEXLC
,
req
.
url
+
"Hel"
+
"lo "
+
""
+
"world"
+
req
.
url
);
set
resp
.
http
.
hexucxcode
=
convert
.
transcode
(
IDENTITY
,
HEX
,
req
.
url
+
"Hel"
+
"lo "
+
""
+
"world"
+
req
.
url
);
set
resp
.
http
.
b64xcode
=
convert
.
transcode
(
IDENTITY
,
BASE64
,
req
.
url
+
"Hello world"
+
req
.
url
);
set
resp
.
http
.
b64urlxcode
=
convert
.
transcode
(
IDENTITY
,
BASE64URL
,
req
.
url
+
"Hello world"
+
req
.
url
);
set
resp
.
http
.
b64urlnopadxcode
=
convert
.
transcode
(
IDENTITY
,
BASE64URLNOPAD
,
req
.
url
+
"Hello world"
+
req
.
url
);
set
resp
.
http
.
id
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
idlist
=
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
+
""
));
set
resp
.
http
.
idempty
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
""
));
set
resp
.
http
.
undef
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
req
.
http
.
unset
));
set
resp
.
http
.
idemptylist
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
req
.
http
.
unset
+
""
+
req
.
http
.
unset
+
""
));
set
resp
.
http
.
hexlc
=
convert
.
encode
(
HEXLC
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
hexuc
=
convert
.
encode
(
HEX
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
sub
vcl_recv
{
return
(
synth
(
200
));
}
sub
vcl_synth
{
set
resp
.
http
.
b64
=
convert
.
encode
(
BASE64
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
b64url
=
convert
.
encode
(
BASE64URL
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
b64urlnopad
=
convert
.
encode
(
BASE64URLNOPAD
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
b64xcode
=
convert
.
transcode
(
IDENTITY
,
BASE64
,
req
.
url
+
"Hello world"
+
req
.
url
);
set
resp
.
http
.
b64urlxcode
=
convert
.
transcode
(
IDENTITY
,
BASE64URL
,
req
.
url
+
"Hello world"
+
req
.
url
);
set
resp
.
http
.
b64urlnopadxcode
=
convert
.
transcode
(
IDENTITY
,
BASE64URLNOPAD
,
req
.
url
+
"Hello world"
+
req
.
url
);
}
}
-
start
client
c1
{
txreq
-
url
"/"
rxresp
expect
resp
.
http
.
hexlcxcode
==
"2f48656c6c6f20776f726c642f"
expect
resp
.
http
.
hexucxcode
==
"2F48656C6C6F20776F726C642F"
expect
resp
.
http
.
b64xcode
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
b64urlxcode
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
b64urlnopadxcode
==
"L0hlbGxvIHdvcmxkLw"
expect
resp
.
http
.
id
==
"The quick brown fox jumps over the lazy dog"
expect
resp
.
http
.
idlist
==
"/The quick brown fox jumps over the lazy dog/"
expect
resp
.
http
.
idempty
==
""
expect
resp
.
http
.
undef
==
""
expect
resp
.
http
.
idemptylist
==
""
expect
resp
.
http
.
hexlc
==
"54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67"
expect
resp
.
http
.
hexuc
==
"54686520717569636B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920646F67"
expect
resp
.
http
.
b64
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw=="
expect
resp
.
http
.
b64url
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw=="
expect
resp
.
http
.
b64urlnopad
==
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
expect
resp
.
http
.
b64xcode
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
b64urlxcode
==
"L0hlbGxvIHdvcmxkLw=="
expect
resp
.
http
.
b64urlnopadxcode
==
"L0hlbGxvIHdvcmxkLw"
}
client
c1
-
run
src/tests/hex.vtc
0 → 100644
View file @
ae773ead
# looks like -*- perl -*-
varnishtest
"hex encode and decode"
server
s1
{}
-
start
varnish
v1
-
vcl
+
backend
{
import
convert
from
"${vmod_topbuild}/src/.libs/libvmod_convert.so"
;
sub
vcl_recv
{
return
(
synth
(
200
));
}
sub
vcl_synth
{
set
resp
.
http
.
hexlc
=
convert
.
encode
(
HEXLC
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
hexuc
=
convert
.
encode
(
HEX
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
hexlcxcode
=
convert
.
transcode
(
IDENTITY
,
HEXLC
,
req
.
url
+
"Hel"
+
"lo "
+
""
+
"world"
+
req
.
url
);
set
resp
.
http
.
hexucxcode
=
convert
.
transcode
(
IDENTITY
,
HEX
,
req
.
url
+
"Hel"
+
"lo "
+
""
+
"world"
+
req
.
url
);
}
}
-
start
client
c1
{
txreq
-
url
"/"
rxresp
expect
resp
.
http
.
hexlc
==
"54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67"
expect
resp
.
http
.
hexuc
==
"54686520717569636B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920646F67"
expect
resp
.
http
.
hexlcxcode
==
"2f48656c6c6f20776f726c642f"
expect
resp
.
http
.
hexucxcode
==
"2F48656C6C6F20776F726C642F"
}
client
c1
-
run
src/tests/id.vtc
0 → 100644
View file @
ae773ead
# looks like -*- perl -*-
varnishtest
"IDENTITY encode and decode"
server
s1
{}
-
start
varnish
v1
-
vcl
+
backend
{
import
convert
from
"${vmod_topbuild}/src/.libs/libvmod_convert.so"
;
sub
vcl_recv
{
return
(
synth
(
200
));
}
sub
vcl_synth
{
set
resp
.
http
.
id
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
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
+
""
));
set
resp
.
http
.
empty
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
""
));
set
resp
.
http
.
undef
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
req
.
http
.
unset
));
set
resp
.
http
.
emptylist
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
req
.
http
.
unset
+
""
+
req
.
http
.
unset
+
""
));
}
}
-
start
client
c1
{
txreq
-
url
"/"
rxresp
expect
resp
.
http
.
id
==
"The quick brown fox jumps over the lazy dog"
expect
resp
.
http
.
list
==
"/The quick brown fox jumps over the lazy dog/"
expect
resp
.
http
.
empty
==
""
expect
resp
.
http
.
undef
==
""
expect
resp
.
http
.
emptylist
==
""
}
client
c1
-
run
src/tests/xcode.vtc
0 → 100644
View file @
ae773ead
# looks like -*- perl -*-
varnishtest
"Test transcode()"
server
s1
{}
-
start
varnish
v1
-
vcl
+
backend
{
import
convert
from
"${vmod_topbuild}/src/.libs/libvmod_convert.so"
;
sub
vcl_recv
{
return
(
synth
(
200
));
}
sub
vcl_synth
{
set
resp
.
http
.
id2id
=
convert
.
transcode
(
IDENTITY
,
IDENTITY
,
"Hello world"
);
set
resp
.
http
.
hex2hex
=
convert
.
transcode
(
HEX
,
HEX
,
"0123456789ABCDEF"
);
# set resp.http.hexlc2hexlc
# = convert.transcode(HEXLC, HEXLC, "0123456789abcdef");
set
resp
.
http
.
b642b64
=
convert
.
transcode
(
BASE64
,
BASE64
,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+
"ghijklmnopqrstuvwxyz0123456789+/"
);
set
resp
.
http
.
b64url2b64url
=
convert
.
transcode
(
BASE64URL
,
BASE64URL
,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+
"ghijklmnopqrstuvwxyz0123456789-_"
);
set
resp
.
http
.
b64urlnopad2b64urlnopad
=
convert
.
transcode
(
BASE64URLNOPAD
,
BASE64URLNOPAD
,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+
"ghijklmnopqrstuvwxyz0123456789-_"
);
}
}
-
start
client
c1
{
txreq
-
url
"/"
rxresp
expect
resp
.
http
.
id2id
==
"Hello world"
expect
resp
.
http
.
hex2hex
==
"0123456789ABCDEF"
# expect resp.http.hexlc2hexlc == "0123456789abcdef"
expect
resp
.
http
.
b642b64
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
expect
resp
.
http
.
b64url2b64url
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
expect
resp
.
http
.
b64urlnopad2b64urlnopad
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
}
client
c1
-
run
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