mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
bugfix: socket open address, and httpd bodylimit
This commit is contained in:
@@ -66,6 +66,7 @@ skynet.start(function()
|
||||
end
|
||||
local balance = 1
|
||||
local id = socket.listen("0.0.0.0", 8001)
|
||||
skynet.error("Listen web port 8001")
|
||||
socket.start(id , function(id, addr)
|
||||
skynet.error(string.format("%s connected, pass it to agent :%08x", addr, agent[balance]))
|
||||
skynet.send(agent[balance], "lua", id)
|
||||
|
||||
@@ -317,9 +317,9 @@ filter_data(lua_State *L, int fd, uint8_t * buffer, int size) {
|
||||
}
|
||||
|
||||
static void
|
||||
pushstring(lua_State *L, const char * msg) {
|
||||
pushstring(lua_State *L, const char * msg, int size) {
|
||||
if (msg) {
|
||||
lua_pushstring(L, msg);
|
||||
lua_pushlstring(L, msg, size);
|
||||
} else {
|
||||
lua_pushliteral(L, "");
|
||||
}
|
||||
@@ -365,12 +365,12 @@ lfilter(lua_State *L) {
|
||||
lua_pushvalue(L, lua_upvalueindex(TYPE_OPEN));
|
||||
// ignore listen id (message->id);
|
||||
lua_pushinteger(L, message->ud);
|
||||
pushstring(L, buffer);
|
||||
pushstring(L, buffer, size);
|
||||
return 4;
|
||||
case SKYNET_SOCKET_TYPE_ERROR:
|
||||
lua_pushvalue(L, lua_upvalueindex(TYPE_ERROR));
|
||||
lua_pushinteger(L, message->id);
|
||||
pushstring(L, buffer);
|
||||
pushstring(L, buffer, size);
|
||||
return 4;
|
||||
default:
|
||||
// never get here
|
||||
|
||||
@@ -83,7 +83,7 @@ local function readall(readbytes, bodylimit)
|
||||
else
|
||||
-- identity mode
|
||||
if length then
|
||||
if length > bodylimit then
|
||||
if bodylimit and length > bodylimit then
|
||||
return 413
|
||||
end
|
||||
if #body >= length then
|
||||
|
||||
Reference in New Issue
Block a user