Skip to content

Commit

Permalink
bugfix: socket open address, and httpd bodylimit
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Oct 29, 2014
1 parent 2ab689f commit 6c9ad16
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/simpleweb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions lualib-src/lua-netpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "");
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lualib/http/httpd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c9ad16

Please sign in to comment.