uhttpd: add explicit stdin eof notification for Lua and CGI childs
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 2 Jun 2012 14:56:24 +0000 (14:56 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 2 Jun 2012 14:56:24 +0000 (14:56 +0000)
SVN-Revision: 32027

package/uhttpd/Makefile
package/uhttpd/src/uhttpd-cgi.c
package/uhttpd/src/uhttpd-lua.c

index 13da14dfe92db5b31116c4dff8cff2a906d9e471..9d8f9fa95d3f944eed3603a9ffa8855b945be49f 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=34
+PKG_RELEASE:=35
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 PKG_CONFIG_DEPENDS := \
index 2f7ea7afaa77f2b9a5cfe7bc29b7af2890b12694..5e445ca372521023ad9eba92952c56a4817ba13f 100644 (file)
@@ -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 */
index 7d602f7c585efce0ca6b99e8619003512368894e..e8d932b47b4246affc58db0d68f7cc71aeb0b125 100644 (file)
@@ -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 */