Skip to content

Instantly share code, notes, and snippets.

@ifduyue
Last active December 16, 2015 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ifduyue/5464833 to your computer and use it in GitHub Desktop.
Save ifduyue/5464833 to your computer and use it in GitHub Desktop.
openresty version
# curl 127.0.0.1/test
package.path: /usr/local/openresty/nginx//?.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.0.0/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua;
package.cpath: /usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
cjson._VERSION: nil
[1,2,3]
# curl 127.0.0.1/test
curl: (52) Empty reply from server
2013/04/26 11:06:17 [error] 2611#0: *1128884 lua entry thread aborted: runtime error: [string "content_by_lua"]:5: attempt to index global 'cjson' (a nil value)
stack traceback:
coroutine 0:
[string "content_by_lua"]: in function <[string "content_by_lua"]:1>, client: 127.0.0.1, server: localhost, request: "GET /test HTTP/1.1", host: "127.0.0.1"
# /usr/local/openresty/nginx/sbin/nginx -V
nginx version: ngx_openresty/1.2.6.6
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --add-module=../ngx_devel_kit-0.2.18 --add-module=../iconv-nginx-module-0.10rc7 --add-module=../echo-nginx-module-0.42 --add-module=../xss-nginx-module-0.03rc9 --add-module=../ngx_coolkit-0.2rc1 --add-module=../set-misc-nginx-module-0.22rc8 --add-module=../form-input-nginx-module-0.07 --add-module=../encrypted-session-nginx-module-0.02 --add-module=../drizzle-nginx-module-0.1.4 --add-module=../ngx_postgres-1.0rc2 --add-module=../srcache-nginx-module-0.19 --add-module=../ngx_lua-0.7.15 --add-module=../headers-more-nginx-module-0.19 --add-module=../array-var-nginx-module-0.03rc1 --add-module=../memc-nginx-module-0.13rc3 --add-module=../redis2-nginx-module-0.09 --add-module=../redis-nginx-module-0.3.6 --add-module=../auth-request-nginx-module-0.2 --add-module=../rds-json-nginx-module-0.12rc10 --add-module=../rds-csv-nginx-module-0.05rc2 --with-ld-opt=-Wl,-rpath,/usr/lib:/usr/local/openresty/luajit/lib --with-pcre-jit --with-http_ssl_module
location = /test {
default_type 'application/json';
content_by_lua '
require "cjson"
ngx.say("package.path: ", package.path)
ngx.say("package.cpath: ", package.cpath)
ngx.say("cjson._VERSION: ", cjson._VERSION)
ngx.say(cjson.encode{1,2,3})
';
}
# pwd
/usr/local/openresty/lualib
# strings cjson.so
O;BE
__gmon_start__
_fini
__cxa_finalize
_Jv_RegisterClasses
lua_touserdata
strbuf_free
strncasecmp
lua_tolstring
strbuf_resize
strbuf_append_string
lua_gettop
luaL_argerror
lua_pushlightuserdata
lua_gettable
lua_settop
luaL_checkinteger
lua_type
lua_toboolean
lua_pushboolean
lua_pushinteger
luaL_error
lua_pushstring
luaL_checkoption
luaL_checktype
__sprintf_chk
strtod
memcpy
__stack_chk_fail
__assert_fail
lua_checkstack
lua_createtable
lua_pushlstring
lua_rawset
lua_rawseti
lua_pushnumber
luaL_checklstring
strbuf_new
lua_typename
lua_pushnil
lua_next
lua_tonumber
floor
__isinf
__isnan
strbuf_append_fmt
lua_rawgeti
strbuf_init
luaopen_cjson
lua_newuserdata
lua_pushcclosure
lua_setfield
lua_setmetatable
lua_settable
luaL_register
stderr
__vfprintf_chk
fputc
exit
malloc
strbuf_set_increment
__fprintf_chk
strbuf_free_to_string
realloc
__vsnprintf_chk
strbuf_append_fmt_retry
libc.so.6
_edata
__bss_start
_end
GLIBC_2.14
GLIBC_2.4
GLIBC_2.3.4
GLIBC_2.2.5
%zV
%rV
%jV
%bV
%ZV
%RV
%JV
%BV
%:V
%2V
%*V
%"V
%zU
%rU
%jU
%bU
%ZU
%RU
%JU
%BU
%:U
%2U
%*U
%"U
=0U
ATSubH
%lH
[A\]
=(H
0tI1
9~;H
fffff.
AUATUSH
-^G
H9,$H
H9,$
[]A\A]
ATUSH
5*Q
fffff.
ffff.
\$(H
l$0L
d$8L
l$@L
t$HL
|$PH
-uEH
ffff.
AUATUH
X[]A\A]
HcT$ H
D$0t
l$0H
l$0A
D$0t
D$0u
D$0t
X[]A\A]
X[]A\A]
X[]A\A]
X[]A\A]
D$8H
D$0H
D$4H
fff.
AUATUSH
l$8H
D$ u$H
D$ t
d$ t
D$ t
D$ H
D$$H
[]A\A]
d$ H
fff.
AWAVAUATI
[]A\A]A^A_H
null
([]A\A]A^A_
true
]A\A]A^A_
[]A\A]A^A_
fals
}sE9
([]A\A]A^A_
fff.
ATUH
ffff.
D$ H
D$(H
D$0H
D$8H
D$@H
D$HH
D$PH
D$XH
D$`H
t$(H
T$0H
L$8L
D$@L
L$Ht7
)D$P
)L$`
)T$p
ffffff.
u@HcC
d$ H
[]A\
L$HL
D$PL
L$Xt:
)D$`
)L$p
}^Hc{
D$ H
AVAUATUSH
T$0H
L$8L
D$@L
L$Ht7
)D$P
)L$`
)T$p
[]A\A]A^
found too many arguments
expected integer >= 0
expected boolean
%%.%dg
expected positive integer
lua_cjson.c
unexpected end of string
invalid unicode escape code
invalid escape code
invalid number
true
false
null
invalid token
object key string
colon
comma or object end
comma or array end
value
the end
must not be NaN or Inf
Cannot serialise %s: %s
excessively sparse array
type not supported
expected 1 argument
encode
decode
encode_sparse_array
encode_max_depth
encode_number_precision
encode_keep_buffer
refuse_invalid_numbers
__gc
cjson
1.0.3
version
none
both
T_OBJ_BEGIN
T_OBJ_END
T_ARR_BEGIN
T_ARR_END
T_STRING
T_NUMBER
T_BOOLEAN
T_NULL
T_COLON
T_COMMA
T_END
T_WHITESPACE
T_ERROR
T_UNKNOWN
\u0000
\u0001
\u0002
\u0003
\u0004
\u0005
\u0006
\u0007
\u000b
\u000e
\u000f
\u0010
\u0011
\u0012
\u0013
\u0014
\u0015
\u0016
\u0017
\u0018
\u0019
\u001a
\u001b
\u001c
\u001d
\u001e
\u001f
\u007f
BUG: Unable to fetch CJSON configuration
expected integer between 1 and 14
json->data[json->index] == '"'
Too many nested data structures
Expected %s but found %s at character %d
JSON parser does not support UTF-16 or UTF-32
Cannot serialise, excessive nesting (%d)
table key must be a number or string
json_next_string_token
Out of memory
BUG: Invalid string increment
strbuf(%lx) resize: %d => %d
BUG: Unable to convert number
strbuf(%lx) reallocs: %d, length: %d, size: %d
BUG: Invalid strbuf length requested
BUG: length of formatted string changed
;*3$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment