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
99e3618a
Commit
99e3618a
authored
Jan 25, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
distinguish between the decoding HEX and the encodings HEXUC and HEXLC
parent
ef22cf37
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
16 deletions
+13
-16
gen_enum_parse.pl
src/gen_enum_parse.pl
+1
-0
hex.c
src/hex.c
+1
-0
hex.vtc
src/tests/hex.vtc
+3
-3
xcode.vtc
src/tests/xcode.vtc
+5
-9
vmod_convert.c
src/vmod_convert.c
+1
-2
vmod_convert.vcc
src/vmod_convert.vcc
+2
-2
No files found.
src/gen_enum_parse.pl
View file @
99e3618a
...
...
@@ -108,6 +108,7 @@ my @vals = (qw(
BASE64URL
BASE64URLNOPAD
HEX
HEXUC
HEXLC)
);
unless
(
$#ARGV
==
1
)
{
...
...
src/hex.c
View file @
99e3618a
...
...
@@ -120,6 +120,7 @@ hex_encode(const enum encoding enc, char *restrict const buf,
const
char
*
alphabet
=
hex_alphabet
[
0
];
AN
(
buf
);
assert
(
enc
==
HEXUC
||
enc
==
HEXLC
);
if
(
in
==
NULL
||
inlen
==
0
)
return
0
;
if
(
maxlen
<
hex_encode_l
(
inlen
))
...
...
src/tests/hex.vtc
View file @
99e3618a
...
...
@@ -17,7 +17,7 @@ varnish v1 -vcl+backend {
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
hexuc
=
convert
.
encode
(
HEX
,
convert
.
decode
(
IDENTITY
,
convert
.
encode
(
HEX
UC
,
convert
.
decode
(
IDENTITY
,
"The quick brown fox jumps over the lazy dog"
));
set
resp
.
http
.
decuc
=
...
...
@@ -60,7 +60,7 @@ varnish v1 -vcl+backend {
req
.
url
);
set
resp
.
http
.
hexucxcode
=
convert
.
transcode
(
IDENTITY
,
HEX
,
req
.
url
+
convert
.
transcode
(
IDENTITY
,
HEX
UC
,
req
.
url
+
"Hel"
+
"lo "
+
""
+
"world"
+
req
.
url
);
}
...
...
@@ -92,7 +92,7 @@ varnish v1 -vcl+backend {
sub
vcl_synth
{
set
req
.
http
.
foo
=
"123"
;
set
resp
.
http
.
badhex
=
convert
.
encode
(
HEX
,
set
resp
.
http
.
badhex
=
convert
.
encode
(
HEX
UC
,
convert
.
decode
(
HEX
,
"g"
+
req
.
http
.
foo
));
}
}
...
...
src/tests/xcode.vtc
View file @
99e3618a
...
...
@@ -16,7 +16,7 @@ varnish v1 -vcl+backend {
=
convert
.
transcode
(
IDENTITY
,
IDENTITY
,
"Hello world"
);
set
resp
.
http
.
hexuc2hexuc
=
convert
.
transcode
(
HEX
,
HEX
,
"0123456789ABCDEF"
);
=
convert
.
transcode
(
HEX
,
HEX
UC
,
"0123456789ABCDEF"
);
set
resp
.
http
.
hexlc2hexlc
=
convert
.
transcode
(
HEX
,
HEXLC
,
"0123456789abcdef"
);
...
...
@@ -25,10 +25,10 @@ varnish v1 -vcl+backend {
=
convert
.
transcode
(
HEX
,
HEXLC
,
"0123456789ABCDEF"
);
set
resp
.
http
.
hexlc2hexuc
=
convert
.
transcode
(
HEX
,
HEX
,
"0123456789abcdef"
);
=
convert
.
transcode
(
HEX
,
HEX
UC
,
"0123456789abcdef"
);
set
resp
.
http
.
hexmix2hexuc
=
convert
.
transcode
(
HEX
,
HEX
,
"0123456789ABCdef"
);
=
convert
.
transcode
(
HEX
,
HEX
UC
,
"0123456789ABCdef"
);
set
resp
.
http
.
hexmix2hexlc
=
convert
.
transcode
(
HEX
,
HEXLC
,
"0123456789abcDEF"
);
...
...
@@ -56,7 +56,6 @@ varnish v1 -vcl+backend {
"+/+/"
+
req
.
http
.
foo
);
set
resp
.
http
.
badpad
=
convert
.
transcode
(
BASE64URLNOPAD
,
IDENTITY
,
"TWFu"
+
req
.
http
.
foo
);
set
resp
.
http
.
badhex2hex
=
convert
.
transcode
(
HEX
,
HEX
,
"abcdefg"
);
set
resp
.
http
.
bad64264
=
convert
.
transcode
(
BASE64
,
BASE64
,
"_-_-"
+
req
.
http
.
foo
);
set
resp
.
http
.
badurl2url
=
convert
.
transcode
(
BASE64URL
,
BASE64URL
,
...
...
@@ -74,14 +73,13 @@ client c1 {
expect
resp
.
http
.
hexuc2hexuc
==
"0123456789ABCDEF"
expect
resp
.
http
.
hexlc2hexlc
==
"0123456789abcdef"
expect
resp
.
http
.
hexuc2hexlc
==
"0123456789abcdef"
#
expect resp.http.hexlc2hexuc == "0123456789ABCDEF"
#
expect resp.http.hexmix2hexuc == "0123456789ABCDEF"
expect
resp
.
http
.
hexlc2hexuc
==
"0123456789ABCDEF"
expect
resp
.
http
.
hexmix2hexuc
==
"0123456789ABCDEF"
expect
resp
.
http
.
hexmix2hexlc
==
"0123456789abcdef"
expect
resp
.
http
.
b642b64
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
expect
resp
.
http
.
b64url2b64url
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
expect
resp
.
http
.
b64urlnopad2b64urlnopad
==
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
expect
resp
.
http
.
badhex
==
""
expect
resp
.
http
.
badhex2hex
==
""
expect
resp
.
http
.
bad64
==
""
expect
resp
.
http
.
bad64264
==
""
expect
resp
.
http
.
badurl
==
""
...
...
@@ -101,8 +99,6 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect
*
=
VCL_Error
"^vmod convert error: cannot decode, illegal encoding beginning with \"\+/\+/\"$"
#"
expect
*
=
VCL_Error
"^vmod convert error: cannot decode, illegal encoding beginning with \"TWFu\"$"
#"
expect
*
=
VCL_Error
"^vmod convert error: cannot decode, illegal encoding beginning with \"abcdefg\"$"
#"
expect
*
=
VCL_Error
"^vmod convert error: cannot decode, illegal encoding beginning with \"_-_-\"$"
#"
...
...
src/vmod_convert.c
View file @
99e3618a
...
...
@@ -94,7 +94,6 @@ decode_l_va(enum encoding dec, const char * const p, va_list ap)
case
BASE64URLNOPAD
:
return
base64_decode_l
(
len
);
case
HEX
:
case
HEXLC
:
return
hex_decode_l
(
len
);
default:
WRONG
(
"Illegal decoding"
);
...
...
@@ -131,7 +130,7 @@ encode(const enum encoding enc, char *restrict const buf, const size_t maxlen,
case
BASE64URL
:
case
BASE64URLNOPAD
:
return
base64_encode
(
enc
,
buf
,
maxlen
,
in
,
inlen
);
case
HEX
:
case
HEX
UC
:
case
HEXLC
:
return
hex_encode
(
enc
,
buf
,
maxlen
,
in
,
inlen
);
default:
...
...
src/vmod_convert.vcc
View file @
99e3618a
...
...
@@ -20,7 +20,7 @@ $Method BLOB .get()
$Function BLOB decode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, STRING_LIST)
XXX DOC
$Function STRING encode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX, HEXLC}, BLOB)
$Function STRING encode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX
UC
, HEXLC}, BLOB)
XXX DOC
$Function STRING transcode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX, HEXLC}, STRING_LIST)
$Function STRING transcode(ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX}, ENUM { IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX
UC
, HEXLC}, STRING_LIST)
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