Permalink
Browse files

renamed ngx.base64_encode and ngx.base64_decode to ngx.encode_base64 …

…and ngx.decode_base64 for consistency.
  • Loading branch information...
agentzh committed Nov 14, 2010
1 parent 47d397d commit b54c7568ad1c5074985b1014d764dfde72f90224
Showing with 58 additions and 58 deletions.
  1. +2 −2 src/ngx_http_lua_hook.c
  2. +2 −2 src/ngx_http_lua_hook.h
  3. +4 −4 src/ngx_http_lua_setby.c
  4. +4 −4 src/ngx_http_lua_util.c
  5. +46 −46 t/013-base64.t
View
@@ -999,7 +999,7 @@ ngx_http_lua_ngx_md5_bin(lua_State *L)
int
-ngx_http_lua_ngx_base64_decode(lua_State *L)
+ngx_http_lua_ngx_decode_base64(lua_State *L)
{
ngx_http_request_t *r;
ngx_str_t p, src;
@@ -1047,7 +1047,7 @@ ngx_http_lua_ngx_base64_decode(lua_State *L)
int
-ngx_http_lua_ngx_base64_encode(lua_State *L)
+ngx_http_lua_ngx_encode_base64(lua_State *L)
{
ngx_http_request_t *r;
ngx_str_t p, src;
View
@@ -32,8 +32,8 @@ int ngx_http_lua_ngx_quote_sql_str(lua_State *L);
int ngx_http_lua_ngx_md5(lua_State *L);
int ngx_http_lua_ngx_md5_bin(lua_State *L);
-int ngx_http_lua_ngx_base64_decode(lua_State *L);
-int ngx_http_lua_ngx_base64_encode(lua_State *L);
+int ngx_http_lua_ngx_decode_base64(lua_State *L);
+int ngx_http_lua_ngx_encode_base64(lua_State *L);
int ngx_http_lua_ngx_get_today(lua_State *L);
int ngx_http_lua_ngx_get_now(lua_State *L);
View
@@ -94,11 +94,11 @@ ngx_http_lua_set_by_lua_env(lua_State *L, ngx_http_request_t *r, size_t nargs,
lua_pushcfunction(L, ngx_http_lua_ngx_quote_sql_str);
lua_setfield(L, -2, "quote_sql_str");
- lua_pushcfunction(L, ngx_http_lua_ngx_base64_decode);
- lua_setfield(L, -2, "base64_decode");
+ lua_pushcfunction(L, ngx_http_lua_ngx_decode_base64);
+ lua_setfield(L, -2, "decode_base64");
- lua_pushcfunction(L, ngx_http_lua_ngx_base64_encode);
- lua_setfield(L, -2, "base64_encode");
+ lua_pushcfunction(L, ngx_http_lua_ngx_encode_base64);
+ lua_setfield(L, -2, "encode_base64");
lua_pushcfunction(L, ngx_http_lua_ngx_md5_bin);
lua_setfield(L, -2, "md5_bin");
View
@@ -475,11 +475,11 @@ init_ngx_lua_globals(lua_State *L)
lua_pushcfunction(L, ngx_http_lua_ngx_quote_sql_str);
lua_setfield(L, -2, "quote_sql_str");
- lua_pushcfunction(L, ngx_http_lua_ngx_base64_decode);
- lua_setfield(L, -2, "base64_decode");
+ lua_pushcfunction(L, ngx_http_lua_ngx_decode_base64);
+ lua_setfield(L, -2, "decode_base64");
- lua_pushcfunction(L, ngx_http_lua_ngx_base64_encode);
- lua_setfield(L, -2, "base64_encode");
+ lua_pushcfunction(L, ngx_http_lua_ngx_encode_base64);
+ lua_setfield(L, -2, "encode_base64");
lua_pushcfunction(L, ngx_http_lua_ngx_md5_bin);
lua_setfield(L, -2, "md5_bin");
View
@@ -19,149 +19,149 @@ __DATA__
=== TEST 1: base64 encode hello
--- config
- location = /base64_encode {
- content_by_lua 'ngx.say(ngx.base64_encode("hello"))';
+ location = /encode_base64 {
+ content_by_lua 'ngx.say(ngx.encode_base64("hello"))';
}
--- request
-GET /base64_encode
+GET /encode_base64
--- response_body
aGVsbG8=
-=== TEST 2: nil string to ngx.base64_encode
+=== TEST 2: nil string to ngx.encode_base64
--- config
- location = /base64_encode {
- content_by_lua 'ngx.say("left" .. ngx.base64_encode(nil) .. "right")';
+ location = /encode_base64 {
+ content_by_lua 'ngx.say("left" .. ngx.encode_base64(nil) .. "right")';
}
--- request
-GET /base64_encode
+GET /encode_base64
--- response_body
leftright
-=== TEST 3: null string to ngx.base64_encode
+=== TEST 3: null string to ngx.encode_base64
--- config
- location = /base64_encode {
- content_by_lua 'ngx.say("left" .. ngx.base64_encode("") .. "right")';
+ location = /encode_base64 {
+ content_by_lua 'ngx.say("left" .. ngx.encode_base64("") .. "right")';
}
--- request
-GET /base64_encode
+GET /encode_base64
--- response_body
leftright
-=== TEST 4: use ngx.base64_encode in set_by_lua
+=== TEST 4: use ngx.encode_base64 in set_by_lua
--- config
- location = /base64_encode {
- set_by_lua $a 'return ngx.base64_encode("hello")';
+ location = /encode_base64 {
+ set_by_lua $a 'return ngx.encode_base64("hello")';
echo $a;
}
--- request
-GET /base64_encode
+GET /encode_base64
--- response_body
aGVsbG8=
-=== TEST 5: use ngx.base64_encode in set_by_lua (nil)
+=== TEST 5: use ngx.encode_base64 in set_by_lua (nil)
--- config
- location = /base64_encode {
- set_by_lua $a 'return "left" .. ngx.base64_encode(nil) .. "right"';
+ location = /encode_base64 {
+ set_by_lua $a 'return "left" .. ngx.encode_base64(nil) .. "right"';
echo $a;
}
--- request
-GET /base64_encode
+GET /encode_base64
--- response_body
leftright
-=== TEST 6: use ngx.base64_encode in set_by_lua (null string)
+=== TEST 6: use ngx.encode_base64 in set_by_lua (null string)
--- config
- location /base64_encode {
- set_by_lua $a 'return "left" .. ngx.base64_encode("") .. "right"';
+ location /encode_base64 {
+ set_by_lua $a 'return "left" .. ngx.encode_base64("") .. "right"';
echo $a;
}
--- request
-GET /base64_encode
+GET /encode_base64
--- response_body
leftright
=== TEST 7: base64 encode hello
--- config
- location = /base64_decode {
- content_by_lua 'ngx.say(ngx.base64_decode("aGVsbG8="))';
+ location = /decode_base64 {
+ content_by_lua 'ngx.say(ngx.decode_base64("aGVsbG8="))';
}
--- request
-GET /base64_decode
+GET /decode_base64
--- response_body
hello
-=== TEST 8: nil string to ngx.base64_decode
+=== TEST 8: nil string to ngx.decode_base64
--- config
- location = /base64_decode {
- content_by_lua 'ngx.say("left" .. ngx.base64_decode(nil) .. "right")';
+ location = /decode_base64 {
+ content_by_lua 'ngx.say("left" .. ngx.decode_base64(nil) .. "right")';
}
--- request
-GET /base64_decode
+GET /decode_base64
--- response_body
leftright
-=== TEST 9: null string to ngx.base64_decode
+=== TEST 9: null string to ngx.decode_base64
--- config
- location = /base64_decode {
- content_by_lua 'ngx.say("left" .. ngx.base64_decode("") .. "right")';
+ location = /decode_base64 {
+ content_by_lua 'ngx.say("left" .. ngx.decode_base64("") .. "right")';
}
--- request
-GET /base64_decode
+GET /decode_base64
--- response_body
leftright
-=== TEST 10: use ngx.base64_decode in set_by_lua
+=== TEST 10: use ngx.decode_base64 in set_by_lua
--- config
- location = /base64_decode {
- set_by_lua $a 'return ngx.base64_decode("aGVsbG8=")';
+ location = /decode_base64 {
+ set_by_lua $a 'return ngx.decode_base64("aGVsbG8=")';
echo $a;
}
--- request
-GET /base64_decode
+GET /decode_base64
--- response_body
hello
-=== TEST 11: use ngx.base64_decode in set_by_lua (nil)
+=== TEST 11: use ngx.decode_base64 in set_by_lua (nil)
--- config
- location = /base64_decode {
- set_by_lua $a 'return "left" .. ngx.base64_decode(nil) .. "right"';
+ location = /decode_base64 {
+ set_by_lua $a 'return "left" .. ngx.decode_base64(nil) .. "right"';
echo $a;
}
--- request
-GET /base64_decode
+GET /decode_base64
--- response_body
leftright
-=== TEST 12: use ngx.base64_decode in set_by_lua (null string)
+=== TEST 12: use ngx.decode_base64 in set_by_lua (null string)
--- config
- location /base64_decode {
- set_by_lua $a 'return "left" .. ngx.base64_decode("") .. "right"';
+ location /decode_base64 {
+ set_by_lua $a 'return "left" .. ngx.decode_base64("") .. "right"';
echo $a;
}
--- request
-GET /base64_decode
+GET /decode_base64
--- response_body
leftright

0 comments on commit b54c756

Please sign in to comment.