oneoo / alilua Goto Github PK
View Code? Open in Web Editor NEWepoll/kqueue+lua based web server
Home Page: http://alilua.com
License: MIT License
epoll/kqueue+lua based web server
Home Page: http://alilua.com
License: MIT License
作者你微博不能发评论,那就发这里吧。
最近看了下alilua,第一眼看到觉得这就是我要的lua web框架,简单,性能也不错,但是深入了解了,觉得还是不行。
1.很不满意alilua的文件上传,应该是这样的 http://t.cn/hbmfWa ,把上传的文件存入临时文件,再由程序操作,而不是直接存到内存,这样子大文件怎么办?或者可以参考https://github.com/agentzh/lua-resty-upload 的实现,再就是 require 应该支持同虚拟主机的脚本,现在如果在路由里面直接设置 package.path 或 package.cpath ,则每次访问会添加一次。。。应用的程序路由应该只运行一次的。。。。
2.应该给出一些设置,如header的最大字节,post的最大字节等
3.应该给出一个调试设置,调试模式中脚本模板应该不缓存,方便调试。
就是这样了。
http://alilua.com/expertise.html
var stat = fs.statSync(file);
when I executed make install clean, it break with the info:
cp script.lua /usr/local/alilua/
cp: cannot stat `script.lua': No such file or directory
make: *** [install] Error 1
大神抽空弄个中文 搭载教程被。。
包括luajit
在 ubuntu下。
Error: core.lua:419: attempt to index global 'CodeCache' (a nil value)
Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
在mac上编译出现
gcc -I/Users/gnuser/local/lua-5.1/include -I/usr/local/include -I/usr/local/include/luajit-2.0 -I/usr/local/include/luajit-2.1 -I./ -L/Users/gnuser/workspace/server/alilua/luajit/src/ -I/Users/gnuser/workspace/server/alilua/luajit/src/ /Users/gnuser/workspace/server/alilua/luajit/src/libluajit.a -Werror -Wall -pedantic -O3 -fPIC -c -o lzlib.o lzlib.c
clang: error: /Users/gnuser/workspace/server/alilua/luajit/src/libluajit.a: 'linker' input unused
script.lua:151: miss epd!
比如引用了一个不存在的函数,想要的traceback没有,都是上面一个错误。debugtrace应该要得到完善,这样才能提高开发效率。
感觉诸多不稳定因素,codecache没有关闭,setcookie有时重复发了两次(设置session时),session应该做成一个接口,可外接file,memcache,redis等,解决共享session问题
内存会占用到22M左右, 求问有什么办法能降低内存占用么.
因为路由器的ram实在是捉襟见肘(64m)
参考下这个项目:https://github.com/hnakamur/couv
如果基于libuv,可以基本忽略平台和系统的兼容性
routes ['^/ls/'] = function(r)
local command = "/bin/ls"
local handle = io.popen(command)
local result = handle:read("*a")
handle:close()
print(result)
end
http://localhost:8080/ls/
causes alilua to exit.
./alilua --bind=8080
Fri, 13 Jun 2014 08:46:37 WARN [9923-../src/main.c:main:127] no host-route or app arguments! using defalut settings.
Fri, 13 Jun 2014 08:46:45 ALERT [9923-../src/worker.c:on_exit_handler:31] worker 0 exited
Fri, 13 Jun 2014 08:46:45 ALERT [9923-../src/main.c:on_master_exit_handler:29] master exited
also, I had to remove this route:
routes['^/(.*)'] = function(r)
dofile('/index.lua')
end
is there a way to tell alilua that once it found a route match to not execute any others?
hello,偶然发现这个项目,感觉非常不错,文档也清晰,非常赞。
请问,作者还在持续更新开发吗?
如题。
运行下面的例子,报错
Mon, 02 Mar 2015 10:02:34 ERR [3712-core.lua:497] attempt to yield across C-call boundary stack traceback: core.lua:497: in function <core.lua:487>
local db = mysql:new()
local db_ok, err, errno, sqlstate = db:connect({
host = "localhost",
port = 3306,
pool_size = 256,
database = "db",
user = "user",
password = "***"})
if not db_ok then
header('HTTP/1.1 503 ServerError')
die('MySQL Connection Error.')
end
local res, err, errno, sqlstate = db:query("SELECT * FROM t1 LIMIT 1")
if not res then
echo("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
else
echo("result: ", json_encode(res)..'\n')
end
定位到这里报出的错误。https://github.com/oneoo/alilua/blob/master/lua-libs/mysql.lua#L545
没找到解决办法。
原UA
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130917 Firefox/17.0
变成了
Mozilla/5.0 (X11; Linux x86_64; rv
只取冒号前面的
我的mint机上没装lua,仅仅装了luajit,编译不成功。
RT
典型的服务器的常见应用,更好的介绍alilua + websocket的相关功能。
文件是存在的。但是返回的内容都是空
首页最底下的"fork me on Github"指向的地址404了。
msg:
/home/work/alilua/objs/deps/../../deps/string_utils.c:560: undefined reference to libiconv_open' objs/deps/string_utils.o: In function
lua_f_iconv':
/home/work/alilua/objs/deps/../../deps/string_utils.c:605: undefined reference to libiconv' objs/deps/string_utils.o: In function
_php_iconv_strlen':
/home/work/alilua/objs/deps/../../deps/string_utils.c:676: undefined reference to libiconv' objs/deps/string_utils.o: In function
lua_f_iconv_substr':
/home/work/alilua/objs/deps/../../deps/string_utils.c:801: undefined reference to `libiconv'
collect2: ld 返回 1
make: *** [alilua] 错误 1
my lua version is :
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
测试代码如下。
function on(data,frame_opcode,is_multi_frame)
LOG(INFO, "function:on " .. data)
websocket_send('['..data..']')
end
function loop()
local data = 'text ' .. time()
websocket_send(data)
sleep(2000)
end
websocket_accept(loop, on)
运行配置:
./alilua --bind=127.0.0.1:8080 --log=./log/debug.log,1 --accesslog=./log/accesslog.log
期望:
应该是服务端输出
LOG(INFO, "function:on " .. data)
客户端发过来的数据,实际上服务端并没有输出。
确认客户端已经连接上了服务端,因为客户端一直打输出服务端发送过来的数据。
已经测试过在另一台mac mini 的llvm 5.1版本编译运行通过。现在在另一台llvm 6.0编译不通过。
cc -v的结果。
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
我的机器已经装了luajit-2.0.2,并且我在其他目录用make macosx编译LuaBitOp-1.0.2也可以编译通过。
通过看makefile和日志,
在alilua下的luajit和merry应该已经编译通过。
[ -f lua-libs/bit.so ] || (cd coevent/lua-libs/LuaBitOp-1.0.2 && make LIBLUA="-L/Users/sleepers/opensource_projects/alilua/luajit/src/ -I/Users/sleepers/opensource_projects/alilua/luajit/src/ /Users/sleepers/opensource_projects/alilua/luajit/src/libluajit.a" && cp bit.so ../../../lua-libs/ && make clean);
gcc -fPIC -O2 -fomit-frame-pointer -Wall -I/usr/local/include -I/usr/local/include/luajit-2.0 -I/usr/local/include/luajit-2.1 -c -o bit.o -L/Users/sleepers/opensource_projects/alilua/luajit/src/ -I/Users/sleepers/opensource_projects/alilua/luajit/src/ /Users/sleepers/opensource_projects/alilua/luajit/src/libluajit.a bit.c
clang: warning: /Users/sleepers/opensource_projects/alilua/luajit/src/libluajit.a: 'linker' input unused
clang: warning: argument unused during compilation: '-L/Users/sleepers/opensource_projects/alilua/luajit/src/'
gcc -shared -O3 -fPIC -o bit.so -L/Users/sleepers/opensource_projects/alilua/luajit/src/ -I/Users/sleepers/opensource_projects/alilua/luajit/src/ /Users/sleepers/opensource_projects/alilua/luajit/src/libluajit.a bit.o
Undefined symbols for architecture x86_64:
"_luaL_setfuncs", referenced from:
_luaopen_bit in bit.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bit.so] Error 1
make: *** [main.o] Error 2
注意有一个警告
clang: warning: /Users/sleepers/opensource_projects/alilua/luajit/src/libluajit.a: 'linker' input unused
最后改了一大堆,虽然可以在llvm 6.0版本下编译,但是是hack的方式,不知道官方有没在llvm 6.0上测试过,也不太清楚到底是不是llvm 6.0的问题。
很看好这个项目,感觉比luvit 这个https://github.com/luvit/luvit 轻量的多。也是在一个人可维护的范围内。 :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.