summaryrefslogtreecommitdiff
path: root/package/uhttpd/src
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-06-02 14:56:24 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-06-02 14:56:24 +0000
commit2cf72776d89f96eb6184b084992894c86a62cd00 (patch)
tree7343b0088cfc5c8f42ca6dda6e73201e7c16c66c /package/uhttpd/src
parent2b4ef2eafa64251ea956dab9e4fe013865aced44 (diff)
downloadmtk-20170518-2cf72776d89f96eb6184b084992894c86a62cd00.zip
mtk-20170518-2cf72776d89f96eb6184b084992894c86a62cd00.tar.gz
mtk-20170518-2cf72776d89f96eb6184b084992894c86a62cd00.tar.bz2
uhttpd: add explicit stdin eof notification for Lua and CGI childs
SVN-Revision: 32027
Diffstat (limited to 'package/uhttpd/src')
-rw-r--r--package/uhttpd/src/uhttpd-cgi.c4
-rw-r--r--package/uhttpd/src/uhttpd-lua.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/package/uhttpd/src/uhttpd-cgi.c b/package/uhttpd/src/uhttpd-cgi.c
index 2f7ea7a..5e445ca 100644
--- a/package/uhttpd/src/uhttpd-cgi.c
+++ b/package/uhttpd/src/uhttpd-cgi.c
@@ -181,6 +181,10 @@ static bool uh_cgi_socket_cb(struct client *cl)
/* ... write to CGI process */
len = uh_raw_send(state->wfd, buf, len,
cl->server->conf->script_timeout);
+
+ /* explicit EOF notification for the child */
+ if (state->content_length <= 0)
+ close(state->wfd);
}
/* try to read data from child */
diff --git a/package/uhttpd/src/uhttpd-lua.c b/package/uhttpd/src/uhttpd-lua.c
index 7d602f7..e8d932b 100644
--- a/package/uhttpd/src/uhttpd-lua.c
+++ b/package/uhttpd/src/uhttpd-lua.c
@@ -298,9 +298,13 @@ static bool uh_lua_socket_cb(struct client *cl)
else
state->content_length = 0;
- /* ... write to CGI process */
+ /* ... write to Lua process */
len = uh_raw_send(state->wfd, buf, len,
cl->server->conf->script_timeout);
+
+ /* explicit EOF notification for the child */
+ if (state->content_length <= 0)
+ close(state->wfd);
}
/* try to read data from child */