summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/uhttpd/src
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-03-20 13:55:54 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-03-20 13:55:54 +0000
commitc153eeaef2216f6e3a0b06f50661f4abda0699c6 (patch)
treebc44cc715649d6419363f2246855a3701e90221f /contrib/package/uhttpd/src
parent0f18174879e121e5c5a64de0e3cb88a9c78e2b37 (diff)
uhttpd: treat cgi scripts without any headers as text/plain responses, required for X-Wrt
Diffstat (limited to 'contrib/package/uhttpd/src')
-rw-r--r--contrib/package/uhttpd/src/uhttpd-cgi.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-cgi.c b/contrib/package/uhttpd/src/uhttpd-cgi.c
index 7836167ff..6bab9a409 100644
--- a/contrib/package/uhttpd/src/uhttpd-cgi.c
+++ b/contrib/package/uhttpd/src/uhttpd-cgi.c
@@ -469,8 +469,24 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct uh_path_
/* cgi script did not output useful stuff at all */
if( ! header_sent )
{
- uh_cgi_error_500(cl, req,
- "The CGI program generated an invalid response:\n\n");
+ /* I would do this ...
+ *
+ * uh_cgi_error_500(cl, req,
+ * "The CGI program generated an "
+ * "invalid response:\n\n");
+ *
+ * ... but in order to stay as compatible as possible,
+ * treat whatever we got as text/plain response and
+ * build the required headers here.
+ */
+
+ uh_http_sendf(cl, NULL,
+ "HTTP/%.1f 200 OK\r\n"
+ "Content-Type: text/plain\r\n"
+ "%s\r\n",
+ req->version, (req->version > 1.0)
+ ? "Transfer-Encoding: chunked\r\n" : ""
+ );
uh_http_send(cl, req, hdr, hdrlen);
}