Commit 729f4b15 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Pål Hermunn Johansen

Whitespace OCD

parent 65cccdad
......@@ -51,7 +51,7 @@ varnish v1 -vcl {
decoding=IDENTITY));
set resp.http.truncated =
blob.encode(IDENTITY, blob.decode(HEX, "666f6f00626172"));
blob.encode(IDENTITY, blob.decode(HEX, "666f6f00626172"));
}
} -start
......
......@@ -19,26 +19,26 @@ varnish v1 -arg "-p workspace_client=256k" -vcl {
{"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="};
set resp.http.hexlc =
blob.encode(HEXLC,
blob.encode(HEXLC,
blob.decode(IDENTITY, req.http.pangram));
set resp.http.hexuc =
blob.encode(HEXUC,
blob.encode(HEXUC,
blob.decode(IDENTITY, req.http.pangram));
set resp.http.hobbeslc =
set resp.http.hobbeslc =
blob.encode(HEXLC, blob.decode(IDENTITY, req.http.hobbes));
set resp.http.hobbesuc =
blob.encode(HEXUC, blob.decode(IDENTITY, req.http.hobbes));
set resp.http.all-lc =
set resp.http.all-lc =
blob.encode(HEXLC, blob.decode(BASE64, req.http.b64all));
set resp.http.all-uc =
blob.encode(HEXUC, blob.decode(BASE64, req.http.b64all));
set resp.http.empty-lc =
set resp.http.empty-lc =
blob.encode(HEXLC, blob.decode(IDENTITY, ""));
set resp.http.empty-uc =
......@@ -55,41 +55,41 @@ varnish v1 -arg "-p workspace_client=256k" -vcl {
set req.http.hexucfoobar = "666F6F206261722062617A2071757578";
set req.http.hexlcfoobar = std.tolower(req.http.hexucfoobar);
# Hobbes quotation in hex
set req.http.hexhobbeslc = "4d616e2069732064697374696e677569736865642c206e6f74206f6e6c792062792068697320726561736f6e2c2062757420627920746869732073696e67756c61722070617373696f6e2066726f6d206f7468657220616e696d616c732c2077686963682069732061206c757374206f6620746865206d696e642c20746861742062792061207065727365766572616e6365206f662064656c6967687420696e2074686520636f6e74696e75656420616e6420696e6465666174696761626c652067656e65726174696f6e206f66206b6e6f776c656467652c2065786365656473207468652073686f727420766568656d656e6365206f6620616e79206361726e616c20706c6561737572652e";
set req.http.hexhobbeslc = "4d616e2069732064697374696e677569736865642c206e6f74206f6e6c792062792068697320726561736f6e2c2062757420627920746869732073696e67756c61722070617373696f6e2066726f6d206f7468657220616e696d616c732c2077686963682069732061206c757374206f6620746865206d696e642c20746861742062792061207065727365766572616e6365206f662064656c6967687420696e2074686520636f6e74696e75656420616e6420696e6465666174696761626c652067656e65726174696f6e206f66206b6e6f776c656467652c2065786365656473207468652073686f727420766568656d656e6365206f6620616e79206361726e616c20706c6561737572652e";
set req.http.hexhobbesuc = std.toupper(req.http.hexhobbeslc);
set req.http.hexalluc = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF";
set req.http.hexalluc = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF";
set req.http.hexalllc = std.tolower(req.http.hexalluc);
set req.http.hexallucodd = regsub(req.http.hexalluc, "^0", "");
set req.http.hexalllcodd = regsub(req.http.hexalllc, "^0", "");
set req.http.hexallucodd = regsub(req.http.hexalluc, "^0", "");
set req.http.hexalllcodd = regsub(req.http.hexalllc, "^0", "");
set resp.http.decuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode(HEX, req.http.hexucfoobar));
set resp.http.declc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode(HEX, req.http.hexlcfoobar));
set resp.http.dechobbesuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode(HEX, req.http.hexhobbesuc));
set resp.http.dechobbeslc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode(HEX, req.http.hexhobbeslc));
set resp.http.decalluc =
blob.encode(BASE64, blob.decode(HEX, req.http.hexalluc));
blob.encode(BASE64, blob.decode(HEX, req.http.hexalluc));
set resp.http.decalllc =
blob.encode(BASE64, blob.decode(HEX, req.http.hexalllc));
blob.encode(BASE64, blob.decode(HEX, req.http.hexalllc));
set resp.http.decallucodd =
blob.encode(BASE64, blob.decode(HEX,
blob.encode(BASE64, blob.decode(HEX,
req.http.hexallucodd));
set resp.http.decalllcodd =
blob.encode(BASE64, blob.decode(HEX,
blob.encode(BASE64, blob.decode(HEX,
req.http.hexalllcodd));
set resp.http.decempty =
......@@ -102,7 +102,7 @@ varnish v1 -arg "-p workspace_client=256k" -vcl {
blob.encode(IDENTITY, blob.decode(HEX, "0"));
set resp.http.decemptypieces =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode(HEX, req.http.unset + ""
+ req.http.unset + ""));
......@@ -123,7 +123,7 @@ varnish v1 -arg "-p workspace_client=256k" -vcl {
"F6F206261722062617A20717" + req.http.part2));
set resp.http.decmanypieces =
blob.encode(IDENTITY, blob.decode(HEX, "" + req.http.unset
blob.encode(IDENTITY, blob.decode(HEX, "" + req.http.unset
+ req.http.part1 + req.http.unset + ""
+ req.http.unset + "" + "F6F206261722062617A20717"
+ "" + req.http.unset + req.http.part2
......@@ -188,8 +188,8 @@ client c1 {
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"g\"$"
expect 0 * Begin req
expect * = VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"g\"$"
#"
expect * = End
} -start
......
......@@ -18,26 +18,26 @@ varnish v1 -vcl {
{"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=="};
set resp.http.hexlc =
blob.encode(HEXLC,
blob.encode(HEXLC,
blob.decode_n(5, IDENTITY, req.http.pangram));
set resp.http.hexuc =
blob.encode(HEXUC,
blob.encode(HEXUC,
blob.decode_n(5, IDENTITY, req.http.pangram));
set resp.http.hobbeslc =
set resp.http.hobbeslc =
blob.encode(HEXLC, blob.decode_n(5, IDENTITY, req.http.hobbes));
set resp.http.hobbesuc =
blob.encode(HEXUC, blob.decode_n(5, IDENTITY, req.http.hobbes));
set resp.http.all-lc =
set resp.http.all-lc =
blob.encode(HEXLC, blob.decode_n(8, BASE64, req.http.b64all));
set resp.http.all-uc =
blob.encode(HEXUC, blob.decode_n(8, BASE64, req.http.b64all));
set resp.http.empty-lc =
set resp.http.empty-lc =
blob.encode(HEXLC, blob.decode_n(5, IDENTITY, ""));
set resp.http.empty-uc =
......@@ -54,41 +54,41 @@ varnish v1 -vcl {
set req.http.hexucfoobar = "666F6F206261722062617A2071757578";
set req.http.hexlcfoobar = std.tolower(req.http.hexucfoobar);
# Hobbes quotation in hex
set req.http.hexhobbeslc = "4d616e2069732064697374696e677569736865642c206e6f74206f6e6c792062792068697320726561736f6e2c2062757420627920746869732073696e67756c61722070617373696f6e2066726f6d206f7468657220616e696d616c732c2077686963682069732061206c757374206f6620746865206d696e642c20746861742062792061207065727365766572616e6365206f662064656c6967687420696e2074686520636f6e74696e75656420616e6420696e6465666174696761626c652067656e65726174696f6e206f66206b6e6f776c656467652c2065786365656473207468652073686f727420766568656d656e6365206f6620616e79206361726e616c20706c6561737572652e";
set req.http.hexhobbeslc = "4d616e2069732064697374696e677569736865642c206e6f74206f6e6c792062792068697320726561736f6e2c2062757420627920746869732073696e67756c61722070617373696f6e2066726f6d206f7468657220616e696d616c732c2077686963682069732061206c757374206f6620746865206d696e642c20746861742062792061207065727365766572616e6365206f662064656c6967687420696e2074686520636f6e74696e75656420616e6420696e6465666174696761626c652067656e65726174696f6e206f66206b6e6f776c656467652c2065786365656473207468652073686f727420766568656d656e6365206f6620616e79206361726e616c20706c6561737572652e";
set req.http.hexhobbesuc = std.toupper(req.http.hexhobbeslc);
set req.http.hexalluc = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF";
set req.http.hexalluc = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF";
set req.http.hexalllc = std.tolower(req.http.hexalluc);
set req.http.hexallucodd = regsub(req.http.hexalluc, "^0", "");
set req.http.hexalllcodd = regsub(req.http.hexalllc, "^0", "");
set req.http.hexallucodd = regsub(req.http.hexalluc, "^0", "");
set req.http.hexalllcodd = regsub(req.http.hexalllc, "^0", "");
set resp.http.decuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(10, HEX, req.http.hexucfoobar));
set resp.http.declc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(10, HEX, req.http.hexlcfoobar));
set resp.http.dechobbesuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(12, HEX, req.http.hexhobbesuc));
set resp.http.dechobbeslc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(12, HEX, req.http.hexhobbeslc));
set resp.http.decalluc =
blob.encode(BASE64, blob.decode_n(12, HEX, req.http.hexalluc));
blob.encode(BASE64, blob.decode_n(12, HEX, req.http.hexalluc));
set resp.http.decalllc =
blob.encode(BASE64, blob.decode_n(12, HEX, req.http.hexalllc));
blob.encode(BASE64, blob.decode_n(12, HEX, req.http.hexalllc));
set resp.http.decallucodd =
blob.encode(BASE64, blob.decode_n(11, HEX,
blob.encode(BASE64, blob.decode_n(11, HEX,
req.http.hexallucodd));
set resp.http.decalllcodd =
blob.encode(BASE64, blob.decode_n(11, HEX,
blob.encode(BASE64, blob.decode_n(11, HEX,
req.http.hexalllcodd));
set resp.http.decempty =
......@@ -101,7 +101,7 @@ varnish v1 -vcl {
blob.encode(IDENTITY, blob.decode_n(2, HEX, "0"));
set resp.http.decemptypieces =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(5, HEX, req.http.unset + ""
+ req.http.unset + ""));
......@@ -122,7 +122,7 @@ varnish v1 -vcl {
"F6F206261722062617A20717" + req.http.part2));
set resp.http.decmanypieces =
blob.encode(IDENTITY, blob.decode_n(20, HEX, "" + req.http.unset
blob.encode(IDENTITY, blob.decode_n(20, HEX, "" + req.http.unset
+ req.http.part1 + req.http.unset + ""
+ req.http.unset + "" + "F6F206261722062617A20717"
+ "" + req.http.unset + req.http.part2
......@@ -187,8 +187,8 @@ client c1 {
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"g\"$"
expect 0 * Begin req
expect * = VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"g\"$"
#"
expect * = End
} -start
......
......@@ -18,37 +18,37 @@ varnish v1 -vcl {
{"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a09f9e9d9c9b9a999897969594939291908f8e8d8c8b8a898887868584838281807f7e7d7c7b7a797877767574737271706f6e6d6c6b6a696867666564636261605f5e5d5c5b5a595857565554535251504f4e4d4c4b4a494847464544434241403f3e3d3c3b3a393837363534333231302f2e2d2c2b2a292827262524232221201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100"};
set resp.http.b64 =
blob.encode(BASE64, blob.decode(IDENTITY,
blob.encode(BASE64, blob.decode(IDENTITY,
req.http.pangram));
set resp.http.b64hobbes =
blob.encode(BASE64, blob.decode(IDENTITY,
blob.encode(BASE64, blob.decode(IDENTITY,
req.http.hobbes));
set resp.http.b64all =
blob.encode(BASE64, blob.decode(HEX, req.http.hexall));
set resp.http.b64url =
blob.encode(BASE64URL,
blob.encode(BASE64URL,
blob.decode(IDENTITY, req.http.pangram));
set resp.http.b64urlhobbes =
blob.encode(BASE64URL,
blob.encode(BASE64URL,
blob.decode(IDENTITY, req.http.hobbes));
set resp.http.b64urlall =
blob.encode(BASE64URL, blob.decode(HEX, req.http.hexall));
set resp.http.b64urlnopad =
blob.encode(BASE64URLNOPAD,
blob.encode(BASE64URLNOPAD,
blob.decode(IDENTITY, req.http.pangram));
set resp.http.b64nopadhobbes =
blob.encode(BASE64URLNOPAD,
blob.encode(BASE64URLNOPAD,
blob.decode(IDENTITY, req.http.hobbes));
set resp.http.b64nopadall =
blob.encode(BASE64URLNOPAD,
blob.encode(BASE64URLNOPAD,
blob.decode(HEX, req.http.hexall));
set resp.http.b64empty =
......@@ -134,26 +134,26 @@ varnish v1 -vcl {
blob.decode(BASE64, req.http.pangram));
set resp.http.b64dechobbes =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode(BASE64, req.http.hobbes));
set resp.http.b64decall =
blob.encode(HEXLC, blob.decode(BASE64, req.http.all));
set resp.http.urldechobbes =
blob.encode(IDENTITY, blob.decode(BASE64URL,
blob.encode(IDENTITY, blob.decode(BASE64URL,
req.http.hobbes));
set resp.http.urldecall =
blob.encode(HEXLC,
blob.encode(HEXLC,
blob.decode(BASE64URL, req.http.allurl));
set resp.http.nopaddechobbes =
blob.encode(IDENTITY, blob.decode(BASE64URLNOPAD,
blob.encode(IDENTITY, blob.decode(BASE64URLNOPAD,
req.http.hobbesnopad));
set resp.http.nopaddecall =
blob.encode(HEXLC,
blob.encode(HEXLC,
blob.decode(BASE64URLNOPAD, req.http.allurl));
set resp.http.b64empty =
......@@ -167,34 +167,34 @@ varnish v1 -vcl {
blob.decode(BASE64, req.http.unset + "" + req.http.unset
+ "" + req.http.unset + ""));
set resp.http.decenc
set resp.http.decenc
= blob.encode(BASE64,
blob.decode(BASE64, req.http.foobarbazquux));
set resp.http.l = "L";
set resp.http.dec2pieces
= blob.encode(IDENTITY, blob.decode(BASE64,
resp.http.l + "0hlbGxvIHdvcmxkLw=="));
resp.http.l + "0hlbGxvIHdvcmxkLw=="));
set resp.http.pad = "==";
set resp.http.dec3pieces
= blob.encode(IDENTITY, blob.decode(BASE64,
resp.http.l + "0hlbGxvIHdvcmxkLw"
+ resp.http.pad));
resp.http.l + "0hlbGxvIHdvcmxkLw"
+ resp.http.pad));
set resp.http.mid1 = "GxvI";
set resp.http.mid2 = "dvcmx";
set resp.http.dec7pieces
= blob.encode(IDENTITY, blob.decode(BASE64,
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"
+ resp.http.pad));
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"
+ resp.http.pad));
set resp.http.dec7param
= blob.encode(blob=blob.decode(encoded=resp.http.l + "0hlb"
+ resp.http.mid1 + "H" + resp.http.mid2 + "kLw"
+ resp.http.pad, decoding=BASE64),
encoding=IDENTITY);
+ resp.http.mid1 + "H" + resp.http.mid2 + "kLw"
+ resp.http.pad, decoding=BASE64),
encoding=IDENTITY);
set resp.http.decnopad = blob.encode(IDENTITY,
blob.decode(BASE64URLNOPAD,
......@@ -202,17 +202,17 @@ varnish v1 -vcl {
set resp.http.decnopad2pieces
= blob.encode(IDENTITY, blob.decode(BASE64URLNOPAD,
resp.http.l + "0hlbGxvIHdvcmxkLw"));
resp.http.l + "0hlbGxvIHdvcmxkLw"));
set resp.http.decnopad6pieces
= blob.encode(IDENTITY, blob.decode(BASE64URLNOPAD,
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"));
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"));
set resp.http.decnopadlong
= blob.encode(IDENTITY,
blob.decode(BASE64URLNOPAD,
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
));
}
......@@ -255,19 +255,19 @@ varnish v1 -vcl+backend {
import blob;
sub vcl_deliver {
set req.http.foo = "AAA=";
if (req.url == "/base64") {
set resp.http.bad64 = blob.encode(IDENTITY,
blob.decode(BASE64, "-_-_" + req.http.foo));
}
elsif (req.url == "/base64url") {
set resp.http.badurl = blob.encode(IDENTITY,
blob.decode(BASE64URL, "+/+/" + req.http.foo));
}
elsif (req.url == "/base64urlnopad") {
set resp.http.badpad = blob.encode(IDENTITY,
blob.decode(BASE64URLNOPAD, "TWFu" + req.http.foo));
}
set req.http.foo = "AAA=";
if (req.url == "/base64") {
set resp.http.bad64 = blob.encode(IDENTITY,
blob.decode(BASE64, "-_-_" + req.http.foo));
}
elsif (req.url == "/base64url") {
set resp.http.badurl = blob.encode(IDENTITY,
blob.decode(BASE64URL, "+/+/" + req.http.foo));
}
elsif (req.url == "/base64urlnopad") {
set resp.http.badpad = blob.encode(IDENTITY,
blob.decode(BASE64URLNOPAD, "TWFu" + req.http.foo));
}
}
}
......
......@@ -21,17 +21,17 @@ varnish v1 -vcl {
{"AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZaaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz0000111122223333444455556666777788889999----____"};
set resp.http.dec
= blob.encode(IDENTITY,
= blob.encode(IDENTITY,
blob.decode_n(8, BASE64,
req.http.foobarbazquux));
set resp.http.deceq
= blob.encode(IDENTITY,
= blob.encode(IDENTITY,
blob.decode_n(20, BASE64,
req.http.foobarbazquux));
set resp.http.declong
= blob.encode(IDENTITY,
= blob.encode(IDENTITY,
blob.decode_n(30, BASE64,
req.http.foobarbazquux));
......@@ -40,25 +40,25 @@ varnish v1 -vcl {
blob.decode_n(12, BASE64, req.http.pangram));
set resp.http.b64dechobbes =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(24, BASE64, req.http.hobbes));
set resp.http.b64decall =
blob.encode(HEXLC, blob.decode_n(128, BASE64,
blob.encode(HEXLC, blob.decode_n(128, BASE64,
req.http.all));
set resp.http.urldechobbes =
blob.encode(IDENTITY, blob.decode_n(180, BASE64URL,
blob.encode(IDENTITY, blob.decode_n(180, BASE64URL,
req.http.hobbes));
set resp.http.urldecall =
blob.encode(HEXLC,
blob.encode(HEXLC,
blob.decode_n(256, BASE64URL,
req.http.allurl));
set resp.http.nopaddechobbes =
blob.encode(IDENTITY,
blob.decode_n(500, BASE64URLNOPAD,
blob.decode_n(500, BASE64URLNOPAD,
req.http.hobbesnopad));
set resp.http.nopaddecall =
......@@ -71,14 +71,14 @@ varnish v1 -vcl {
set resp.http.urlempty =
blob.encode(IDENTITY, blob.decode_n(1, BASE64URL, ""));
set resp.http.nopadempty =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(0, BASE64URLNOPAD, ""));
set resp.http.emptypieces =
blob.encode(IDENTITY,
blob.decode_n(0, BASE64, req.http.unset + "" + req.http.unset
+ "" + req.http.unset + ""));
set resp.http.decenc
set resp.http.decenc
= blob.encode(BASE64,
blob.decode_n(20, BASE64,
req.http.foobarbazquux));
......@@ -86,27 +86,27 @@ varnish v1 -vcl {
set resp.http.l = "L";
set resp.http.dec2pieces
= blob.encode(IDENTITY, blob.decode_n(8, BASE64,
resp.http.l + "0hlbGxvIHdvcmxkLw=="));
resp.http.l + "0hlbGxvIHdvcmxkLw=="));
set resp.http.pad = "==";
set resp.http.dec3pieces
= blob.encode(IDENTITY, blob.decode_n(12, BASE64,
resp.http.l + "0hlbGxvIHdvcmxkLw"
+ resp.http.pad));
resp.http.l + "0hlbGxvIHdvcmxkLw"
+ resp.http.pad));
set resp.http.mid1 = "GxvI";
set resp.http.mid2 = "dvcmx";
set resp.http.dec7pieces
= blob.encode(IDENTITY, blob.decode_n(16, BASE64,
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"
+ resp.http.pad));
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"
+ resp.http.pad));
set resp.http.dec7param
= blob.encode(blob=blob.decode_n(encoded=resp.http.l
+ "0hlb" + resp.http.mid1 + "H" + resp.http.mid2
+ "kLw" + resp.http.pad, decoding=BASE64, n=20),
encoding=IDENTITY);
encoding=IDENTITY);
set resp.http.decnopad = blob.encode(IDENTITY,
blob.decode_n(18, BASE64URLNOPAD,
......@@ -114,17 +114,17 @@ varnish v1 -vcl {
set resp.http.decnopad2pieces
= blob.encode(IDENTITY, blob.decode_n(19, BASE64URLNOPAD,
resp.http.l + "0hlbGxvIHdvcmxkLw"));
resp.http.l + "0hlbGxvIHdvcmxkLw"));
set resp.http.decnopad6pieces
= blob.encode(IDENTITY, blob.decode_n(18, BASE64URLNOPAD,
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"));
resp.http.l + "0hlb" + resp.http.mid1
+ "H" + resp.http.mid2 + "kLw"));
set resp.http.decnopadlong
= blob.encode(IDENTITY,
blob.decode_n(60, BASE64URLNOPAD,
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
));
}
......@@ -169,20 +169,20 @@ varnish v1 -vcl+backend {
import blob;
sub vcl_deliver {
set req.http.foo = "AAA=";
if (req.url == "/base64") {
set resp.http.bad64 = blob.encode(IDENTITY,
blob.decode_n(8, BASE64, "-_-_" + req.http.foo));
}
elsif (req.url == "/base64url") {
set resp.http.badurl = blob.encode(IDENTITY,
blob.decode_n(8, BASE64URL, "+/+/" + req.http.foo));
}
elsif (req.url == "/base64urlnopad") {
set resp.http.badpad = blob.encode(IDENTITY,
blob.decode_n(8, BASE64URLNOPAD,
set req.http.foo = "AAA=";
if (req.url == "/base64") {
set resp.http.bad64 = blob.encode(IDENTITY,
blob.decode_n(8, BASE64, "-_-_" + req.http.foo));
}
elsif (req.url == "/base64url") {
set resp.http.badurl = blob.encode(IDENTITY,
blob.decode_n(8, BASE64URL, "+/+/" + req.http.foo));
}
elsif (req.url == "/base64urlnopad") {
set resp.http.badpad = blob.encode(IDENTITY,
blob.decode_n(8, BASE64URLNOPAD,
"TWFu" + req.http.foo));
}
}
}
}
......
This diff is collapsed.
......@@ -12,7 +12,7 @@ varnish v1 -vcl {
sub vcl_synth {
set req.http.urllcfoobar = "foo%3abar%3abaz%3aquux";
set req.http.urlucfoobar = "foo%3Abar%3Abaz%3Aquux";
set req.http.urlhobbeslc = "Man%20is%20distinguished%2c%20not%20only%20by%20his%20reason%2c%20but%20by%20this%20singular%20passion%20from%20other%20animals%2c%20which%20is%20a%20lust%20of%20the%20mind%2c%20that%20by%20a%20perseverance%20of%20delight%20in%20the%20continued%20and%20indefatigable%20generation%20of%20knowledge%2c%20exceeds%20the%20short%20vehemence%20of%20any%20carnal%20pleasure.";
set req.http.urlhobbeslc = "Man%20is%20distinguished%2c%20not%20only%20by%20his%20reason%2c%20but%20by%20this%20singular%20passion%20from%20other%20animals%2c%20which%20is%20a%20lust%20of%20the%20mind%2c%20that%20by%20a%20perseverance%20of%20delight%20in%20the%20continued%20and%20indefatigable%20generation%20of%20knowledge%2c%20exceeds%20the%20short%20vehemence%20of%20any%20carnal%20pleasure.";
set req.http.urlhobbesuc = "Man%20is%20distinguished%2C%20not%20only%20by%20his%20reason%2C%20but%20by%20this%20singular%20passion%20from%20other%20animals%2C%20which%20is%20a%20lust%20of%20the%20mind%2C%20that%20by%20a%20perseverance%20of%20delight%20in%20the%20continued%20and%20indefatigable%20generation%20of%20knowledge%2C%20exceeds%20the%20short%20vehemence%20of%20any%20carnal%20pleasure.";
set req.http.urllcumlauts = "%c3%9cbergr%c3%b6%c3%9fentr%c3%a4ger";
set req.http.urlucumlauts = "%C3%9Cbergr%C3%B6%C3%9Fentr%C3%A4ger";
......@@ -20,57 +20,57 @@ varnish v1 -vcl {
set req.http.urlucphk = "sm%C3%A5b%C3%B8rnsp%C3%A6dagog";
set req.http.urllcutf8 = "%e6%97%a5%e6%89%bc%e8%aa%9e";
set req.http.urlucutf8 = "%E6%97%A5%E6%89%BC%E8%AA%9E";
set req.http.urlalluc = "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF";
set req.http.urlalluc = "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF";
set req.http.urlalllc = "%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c-.%2f0123456789%3a%3b%3c%3d%3e%3f%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5e_%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d~%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff";
set resp.http.decuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(9, URL, req.http.urlucfoobar));
set resp.http.declc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(12, URL, req.http.urllcfoobar));
set resp.http.dechobbesuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(27, URL, req.http.urlhobbesuc));
set resp.http.dechobbeslc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(27, URL, req.http.urlhobbeslc));
set resp.http.decumlautsuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(17, URL,
req.http.urlucumlauts));
set resp.http.decumlautslc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(25, URL,
req.http.urllcumlauts));
set resp.http.decphkuc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(18, URL, req.http.urlucphk));
set resp.http.decphklc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(30, URL, req.http.urllcphk));
set resp.http.decutf8uc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(9, URL, req.http.urlucutf8));
set resp.http.decutf8lc =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(18, URL, req.http.urllcutf8));
set resp.http.decalluc =
blob.encode(HEXLC,
blob.encode(HEXLC,
blob.decode_n(252, URL, req.http.urlalluc));
set resp.http.decalllc =
blob.encode(HEXUC,
blob.encode(HEXUC,
blob.decode_n(252, URL, req.http.urlalllc));
set resp.http.decempty =
......@@ -80,7 +80,7 @@ varnish v1 -vcl {
blob.encode(IDENTITY, blob.decode_n(3, URL, "%00"));
set resp.http.decemptypieces =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(1, URL, req.http.unset + ""
+ req.http.unset + ""));
......@@ -88,7 +88,7 @@ varnish v1 -vcl {
set resp.http.dec2pieces =
blob.encode(IDENTITY,
blob.decode_n(6, URL, req.http.part1 +
"20bar%20baz%20quux"));
"20bar%20baz%20quux"));
set req.http.part2 = "0quux";
set resp.http.dec3param =
......@@ -104,7 +104,7 @@ varnish v1 -vcl {
+ req.http.part2));
set resp.http.decmanypieces =
blob.encode(IDENTITY,
blob.encode(IDENTITY,
blob.decode_n(24, URL, "" + req.http.unset
+ req.http.part1 + req.http.unset + ""
+ req.http.unset + "" + "20bar%20baz%2"
......@@ -148,22 +148,22 @@ varnish v1 -vcl+backend {
import blob;
sub vcl_deliver {
if (req.url == "/percent") {
set resp.http.bad = blob.encode(URLUC,
blob.decode_n(1, URL, "%20"));
}
elsif (req.url == "/percent-two") {
set resp.http.bad = blob.encode(URLUC,
blob.decode_n(2, URL, "%20"));
}
elsif (req.url == "/comma") {
set resp.http.good = blob.encode(IDENTITY,
blob.decode_n(3, URL, "%2c%q"));
}
elsif (req.url == "/colon") {
set resp.http.good = blob.encode(IDENTITY,
blob.decode_n(3, URL, "%3a%2q"));
}
if (req.url == "/percent") {
set resp.http.bad = blob.encode(URLUC,
blob.decode_n(1, URL, "%20"));
}
elsif (req.url == "/percent-two") {
set resp.http.bad = blob.encode(URLUC,
blob.decode_n(2, URL, "%20"));
}
elsif (req.url == "/comma") {
set resp.http.good = blob.encode(IDENTITY,
blob.decode_n(3, URL, "%2c%q"));
}
elsif (req.url == "/colon") {
set resp.http.good = blob.encode(IDENTITY,
blob.decode_n(3, URL, "%3a%2q"));
}
}
}
......@@ -192,6 +192,6 @@ client c1 {
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect * * VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"%20\"$"
expect * * VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"%20\"$"
expect * * VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"%20\"$"
expect * * VCL_Error "^vmod blob error: cannot decode, illegal encoding beginning with \"%20\"$"
} -run
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,7 @@ varnish v1 -arg "-i serverid" -vcl+backend {
"The quick brown fox jumps over the lazy dog");
new idpieces
= blob.blob(IDENTITY, "" + server.identity + " "
+ server.identity + "");
+ server.identity + "");
new idempty = blob.blob(IDENTITY, "");
new idparam
= blob.blob(encoded="" + server.identity + " " + server.identity
......
......@@ -15,9 +15,9 @@ $Module blob 3 utilities for the VCL blob type
BLOB blob.decode(ENUM decoding, STRING_LIST encoded)
BLOB blob.decode_n(INT n, ENUM decoding, STRING_LIST encoded)
STRING blob.transcode(ENUM decoding, ENUM encoding,
STRING_LIST encoded)
STRING_LIST encoded)
STRING blob.transcode_n(INT n, ENUM decoding, ENUM encoding,
STRING_LIST encoded)
STRING_LIST encoded)
# other utilities
BOOL blob.same(BLOB, BLOB)
......@@ -47,7 +47,7 @@ Examples::
sub vcl_deliver {
# The .get() method retrieves the BLOB from an object.
set resp.http.MyBlob-As-Hex
= blob.encode(blob=myblob.get(), encoding=HEXLC);
= blob.encode(blob=myblob.get(), encoding=HEXLC);
# The .encode() method efficiently retrieves an encoding.
set resp.http.YourBlob-As-Base64 = yourblob.encode(BASE64);
......@@ -55,22 +55,22 @@ Examples::
# decode() and encode() functions convert blobs to text and
# vice versa at runtime.
set resp.http.Base64-Encoded
= blob.encode(BASE64,
blob.decode(HEX, req.http.Hex-Encoded));
= blob.encode(BASE64,
blob.decode(HEX, req.http.Hex-Encoded));
}
sub vcl_recv {
# transcode() converts from one encoding to another.
set req.http.Hex-Encoded
= blob.transcode(decoding=BASE64, encoding=HEXUC,
encoded="YmF6");
= blob.transcode(decoding=BASE64, encoding=HEXUC,
encoded="YmF6");
# transcode() from URL to IDENTITY effects a URL decode.
set req.url = blob.transcode(encoded=req.url, decoding=URL);
# transcode() from IDENTITY to URL effects a URL encode.
set req.http.url_urlcoded
= blob.transcode(encoded=req.url, encoding=URLLC);
= blob.transcode(encoded=req.url, encoding=URLLC);
}
ENCODING SCHEMES
......@@ -169,7 +169,7 @@ byte. For example::
set resp.http.Second = "def0";
set resp.http.Hex-Decoded
= blob.encode(HEXLC, blob.decode(HEX,
resp.http.First + resp.http.Second));
resp.http.First + resp.http.Second));
URL*
----
......@@ -182,7 +182,7 @@ RFC3986, the hexadecimal characters A-F being output in lower- and
uppercase, respectively.
$Function BLOB decode(ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEX, URL} decoding="IDENTITY", STRING_LIST encoded)
HEX, URL} decoding="IDENTITY", STRING_LIST encoded)
Returns the BLOB derived from the string ``encoded`` according to the
scheme specified by ``decoding``.
......@@ -209,7 +209,7 @@ the encoded string. If ``n`` is greater than the length of the string,
then return the same result as ``decode()``.
$Function STRING encode(ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEXUC, HEXLC, URLUC, URLLC} encoding="IDENTITY",
HEXUC, HEXLC, URLUC, URLLC} encoding="IDENTITY",
BLOB blob)
Returns a string representation of the BLOB ``blob`` as specifed by
......@@ -233,10 +233,10 @@ Example::
= blob.encode(blob=blob.decode(encoded="foo"));
$Function STRING transcode(ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEX, URL} decoding="IDENTITY",
ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEXUC, HEXLC, URLUC, URLLC} encoding="IDENTITY",
STRING_LIST encoded)
HEX, URL} decoding="IDENTITY",
ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEXUC, HEXLC, URLUC, URLLC} encoding="IDENTITY",
STRING_LIST encoded)
Translates from one encoding to another, by first decoding the string
``encoded`` according to the scheme ``decoding``, and then returning
......@@ -264,10 +264,10 @@ Example::
$Function STRING transcode_n(INT n,
ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEX, URL} decoding="IDENTITY",
ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEXUC, HEXLC, URLUC, URLLC} encoding="IDENTITY",
STRING_LIST encoded)
HEX, URL} decoding="IDENTITY",
ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD,
HEXUC, HEXLC, URLUC, URLLC} encoding="IDENTITY",
STRING_LIST encoded)
Same as ``transcode()``, but only from the first ``n`` characters of
the encoded string.
......@@ -305,8 +305,8 @@ if ``offset + length`` requires more bytes than are available in the
BLOB.
$Object blob(ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEX,
URL} decoding="IDENTITY",
STRING_LIST encoded)
URL} decoding="IDENTITY",
STRING_LIST encoded)
Creates an object that contains the BLOB derived from the string
``encoded`` according to the scheme ``decoding``.
......@@ -337,7 +337,7 @@ Example::
blob.encode(blob=stringblob.get());
$Method STRING .encode(ENUM {IDENTITY, BASE64, BASE64URL, BASE64URLNOPAD, HEXUC,
HEXLC, URLUC, URLLC} encoding="IDENTITY")
HEXLC, URLUC, URLLC} encoding="IDENTITY")
Returns an encoding of BLOB created by the constructor, according to
the scheme ``encoding``.
......
......@@ -42,61 +42,61 @@ EXAMPLE
::
sub vcl_recv {
if (req.method == "PURGE") {
if (client.ip !~ purge_acl) {
return (synth(405));
}
return (hash);
}
if (req.method == "PURGE") {
if (client.ip !~ purge_acl) {
return (synth(405));
}
return (hash);
}
}
sub my_purge {
set req.http.purged = purge.hard();
if (req.http.purged == "0") {
return (synth(404));
}
else {
return (synth(200));
}
set req.http.purged = purge.hard();
if (req.http.purged == "0") {
return (synth(404));
}
else {
return (synth(200));
}
}
sub vcl_hit {
if (req.method == "PURGE") {
call my_purge;
}
if (req.method == "PURGE") {
call my_purge;
}
}
sub vcl_miss {
if (req.method == "PURGE") {
call my_purge;
}
if (req.method == "PURGE") {
call my_purge;
}
}
sub vcl_synth {
if (req.method == "PURGE") {
if (req.http.purged) {
set resp.http.purged = req.http.purged;
}
return (deliver);
}
if (req.method == "PURGE") {
if (req.http.purged) {
set resp.http.purged = req.http.purged;
}
return (deliver);
}
}
$Function INT hard()
Description
This is equivalent to ``return(purge)`` but explicitly called from
``vcl_hit`` and ``vcl_miss``. It returns the number of purged objects.
``vcl_hit`` and ``vcl_miss``. It returns the number of purged objects.
Example
set req.http.purged = purge.hard();
$Function INT soft(DURATION ttl = 0, DURATION grace = -1, DURATION keep = -1)
Description
Sets the TTL, grace and keep. By default, TTL is set to 0 with grace
and keep periods left untouched. Setting a negative value for grace or
keep periods leaves them untouched. Setting all three parameters to
0 is equivalent to a hard purge. It can only be called from ``vcl_hit``
or ``vcl_miss``. It returns the number of soft-purged objects.
Sets the TTL, grace and keep. By default, TTL is set to 0 with grace
and keep periods left untouched. Setting a negative value for grace or
keep periods leaves them untouched. Setting all three parameters to
0 is equivalent to a hard purge. It can only be called from ``vcl_hit``
or ``vcl_miss``. It returns the number of soft-purged objects.
SEE ALSO
========
......
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