[package] uhttpd:
[openwrt.git] / package / uhttpd / src / uhttpd-lua.c
index ab09841..c1e7490 100644 (file)
@@ -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;
                                }
This page took 0.024483 seconds and 4 git commands to generate.