summaryrefslogtreecommitdiff
path: root/uhttpd-lua.c
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-03-27 00:00:33 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-03-27 00:00:33 +0000
commit8bd776dcd165ec1b1d21811e642cf6b2b8483567 (patch)
treebea9734bf2bd993773596f37f2fa87c56516acc4 /uhttpd-lua.c
parentb195c512dd67bae675f26c8414a64031a5edf60f (diff)
downloaduhttpd-8bd776dcd165ec1b1d21811e642cf6b2b8483567.tar.gz
[package] uhttpd:
- make script timeout configurable - catch SIGCHLD to properly interrupt select() - flag listen and client sockets as close-on-exec git-svn-id: svn://svn.openwrt.org/openwrt/trunk/package/uhttpd/src@20500 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'uhttpd-lua.c')
-rw-r--r--uhttpd-lua.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/uhttpd-lua.c b/uhttpd-lua.c
index ab09841..c1e7490 100644
--- a/uhttpd-lua.c
+++ b/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;
}