Commit a2326dfb authored by Geoff Simmons's avatar Geoff Simmons

bugfix hex decode for lower-case hex digits

parent b47ed0a2
......@@ -43,15 +43,15 @@ static const char hex_alphabet[][16] = {
/*
* Shift the ASCII table over so that it begins at '0', and replace the
* hex digits with their binary values. This fits all of the hex digits
* into 54 bytes (cacheline friendly).
* into 55 bytes (cacheline friendly).
*/
static const uint8_t nibble[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 10, 11, 12,
13, 14, 15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 10, 11,
12, 13, 14, 15
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 10,
11, 12, 13, 14, 15
};
static inline int
......
......@@ -20,10 +20,14 @@ varnish v1 -vcl+backend {
convert.encode(HEX, convert.decode(IDENTITY,
"The quick brown fox jumps over the lazy dog"));
set resp.http.dec =
set resp.http.decuc =
convert.encode(IDENTITY, convert.decode(HEX,
"666F6F206261722062617A2071757578"));
set resp.http.declc =
convert.encode(IDENTITY, convert.decode(HEX,
"666f6f206261722062617a2071757578"));
set resp.http.decempty =
convert.encode(IDENTITY, convert.decode(HEX, ""));
......@@ -67,7 +71,8 @@ client c1 {
rxresp
expect resp.http.hexlc == "54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67"
expect resp.http.hexuc == "54686520717569636B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920646F67"
expect resp.http.dec == "foo bar baz quux"
expect resp.http.decuc == "foo bar baz quux"
expect resp.http.declc == "foo bar baz quux"
expect resp.http.decempty == ""
expect resp.http.decempty2bytes == ""
expect resp.http.decempty1byte == ""
......
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