diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 00:00:33 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-27 00:00:33 +0000 |
commit | 8c9b818a24045c15f40fc415cd1dde78c438555a (patch) | |
tree | a4f379b54fac4e4d63352eabd506927395f8c19f /package/uhttpd/src/uhttpd-lua.c | |
parent | d7195c229316346aae4ba5617c20308863a855c5 (diff) | |
download | upstream-8c9b818a24045c15f40fc415cd1dde78c438555a.tar.gz upstream-8c9b818a24045c15f40fc415cd1dde78c438555a.tar.bz2 upstream-8c9b818a24045c15f40fc415cd1dde78c438555a.zip |
uhttpd: - make script timeout configurable - catch SIGCHLD to properly interrupt select() - flag listen and client sockets as close-on-exec
SVN-Revision: 20500
Diffstat (limited to 'package/uhttpd/src/uhttpd-lua.c')
-rw-r--r-- | package/uhttpd/src/uhttpd-lua.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/package/uhttpd/src/uhttpd-lua.c b/package/uhttpd/src/uhttpd-lua.c index ab09841cd6..c1e7490438 100644 --- a/package/uhttpd/src/uhttpd-lua.c +++ b/package/uhttpd/src/uhttpd-lua.c @@ -448,7 +448,7 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L) FD_SET(rfd[0], &reader); FD_SET(wfd[1], &writer); - timeout.tv_sec = 15; + timeout.tv_sec = cl->server->conf->script_timeout; timeout.tv_usec = 0; /* wait until we can read or write or both */ @@ -512,11 +512,15 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L) } } - /* no activity for 15 seconds... looks dead */ + /* timeout exceeded or interrupted by SIGCHLD */ else { - ensure(uh_http_sendhf(cl, 504, "Gateway Timeout", - "The Lua handler took too long to produce a response")); + if( (errno != EINTR) && ! data_sent ) + { + ensure(uh_http_sendhf(cl, 504, "Gateway Timeout", + "The Lua script took too long to produce " + "a response")); + } break; } |