From e23a7bfd807029e99b138116341973db6f0a7feb Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Thu, 15 Nov 2012 14:18:45 +0200 Subject: [PATCH] support asynchronous requests in Lua plugin --- plugins/lua/lua_plugin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c index 2cd27bb5..ea69cc6e 100644 --- a/plugins/lua/lua_plugin.c +++ b/plugins/lua/lua_plugin.c @@ -308,6 +308,8 @@ static const luaL_reg uwsgi_api[] = { static int uwsgi_lua_input(lua_State *L) { struct wsgi_request *wsgi_req = current_wsgi_req(); + int fd = wsgi_req->async_post ? + fileno(wsgi_req->async_post) : wsgi_req->poll.fd; ssize_t sum, len, total; char *buf, *ptr; @@ -330,7 +332,7 @@ static int uwsgi_lua_input(lua_State *L) { ptr = buf; while(total) { - len = read(wsgi_req->poll.fd, ptr, total); + len = read(fd, ptr, total); ptr += len; total -= len; }