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
b77f0963
Commit
b77f0963
authored
Jan 11, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for the previous commit, and permit uppercase hex encoding
parent
3c5b47e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
8 deletions
+53
-8
test01.vtc
src/tests/test01.vtc
+50
-6
vmod_convert.c
src/vmod_convert.c
+1
-0
vmod_convert.vcc
src/vmod_convert.vcc
+2
-2
No files found.
src/tests/test01.vtc
View file @
b77f0963
...
@@ -11,32 +11,76 @@ varnish v1 -vcl+backend {
...
@@ -11,32 +11,76 @@ varnish v1 -vcl+backend {
import
convert
from
"${vmod_topbuild}/src/.libs/libvmod_convert.so"
;
import
convert
from
"${vmod_topbuild}/src/.libs/libvmod_convert.so"
;
sub
vcl_deliver
{
sub
vcl_deliver
{
set
resp
.
http
.
hex
=
set
resp
.
http
.
hex
lcxcode
=
convert
.
transcode
(
IDENTITY
,
HEXLC
,
req
.
url
+
convert
.
transcode
(
IDENTITY
,
HEXLC
,
req
.
url
+
"Hel"
+
"lo "
+
""
+
"world"
+
"Hel"
+
"lo "
+
""
+
"world"
+
req
.
url
);
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
=
set
resp
.
http
.
id
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
idlist
=
set
resp
.
http
.
idlist
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
""
+
req
.
url
+
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
"The quick "
+
"brown fox jumps over "
+
""
+
""
+
req
.
http
.
unset
+
req
.
url
+
"the lazy dog"
+
""
+
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
=
set
resp
.
http
.
idempty
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
""
));
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
""
));
set
resp
.
http
.
undef
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
req
.
http
.
unset
));
set
resp
.
http
.
idemptylist
=
set
resp
.
http
.
idemptylist
=
convert
.
encode
(
IDENTITY
,
convert
.
decode
(
IDENTITY
,
""
+
""
+
""
));
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"
));
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"
));
}
}
}
-
start
}
-
start
client
c1
{
client
c1
{
txreq
-
url
"/"
txreq
-
url
"/"
rxresp
rxresp
expect
resp
.
http
.
hex
==
"2f48656c6c6f20776f726c642f"
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
.
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
.
idlist
==
"/The quick brown fox jumps over the lazy dog/"
expect
resp
.
http
.
idempty
==
""
expect
resp
.
http
.
idempty
==
""
expect
resp
.
http
.
undef
==
""
expect
resp
.
http
.
idemptylist
==
""
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"
}
}
client
c1
-
run
client
c1
-
run
src/vmod_convert.c
View file @
b77f0963
...
@@ -465,6 +465,7 @@ vmod_transcode(VRT_CTX, VCL_ENUM decs, VCL_ENUM encs, const char *p, ...) {
...
@@ -465,6 +465,7 @@ vmod_transcode(VRT_CTX, VCL_ENUM decs, VCL_ENUM encs, const char *p, ...) {
case
IDENTITY
:
case
IDENTITY
:
len
=
id_encode
(
enc
,
wb
.
w
,
wb_space
(
&
wb
),
buf
,
len
);
len
=
id_encode
(
enc
,
wb
.
w
,
wb_space
(
&
wb
),
buf
,
len
);
break
;
break
;
case
HEX
:
case
HEXLC
:
case
HEXLC
:
len
=
hex_encode
(
enc
,
wb
.
w
,
wb_space
(
&
wb
),
buf
,
len
);
len
=
hex_encode
(
enc
,
wb
.
w
,
wb_space
(
&
wb
),
buf
,
len
);
break
;
break
;
...
...
src/vmod_convert.vcc
View file @
b77f0963
...
@@ -16,9 +16,9 @@ $Event event
...
@@ -16,9 +16,9 @@ $Event event
$Function BLOB decode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, STRING_LIST)
$Function BLOB decode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, STRING_LIST)
XXX DOC
XXX DOC
$Function STRING encode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXLC}, BLOB)
$Function STRING encode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX
, HEX
LC}, BLOB)
XXX DOC
XXX DOC
$Function STRING transcode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXLC}, STRING_LIST)
$Function STRING transcode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX
, HEX
LC}, STRING_LIST)
XXX DOC
XXX DOC
$Function BLOB transcode_blob(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXLC}, BLOB)
$Function BLOB transcode_blob(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXLC}, BLOB)
XXX DOC
XXX DOC
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