[hackers] [quark] improve CGI support || Hiltjo Posthuma
commit 2822488312805fd2b02a43fc71ad7c81f39c2a98
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu Aug 14 17:10:38 2014 +0000
improve CGI support
- set some more environment variables (PATH_INFO for example is used by
cgit). Also set REMOTE_ADDR, SERVER_PORT, SERVER_SOFTWARE.
- when a file is requested in cgi mode serve it, if it doesn't exist,
pass it to the CGI script (needed for cgit image/CSS).
diff --git a/quark.c b/quark.c
index dc28d82..a09e572 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -307,6 +307,7 @@ void
responsecgi(void) {
FILE *cgi;
size_t r;
+ char *q;
if (req.type == GET)
setenv("REQUEST_METHOD", "GET", 1);
_AT_@ -316,8 +317,21 @@ responsecgi(void) {
return;
if (*reqhost)
setenv("SERVER_NAME", reqhost, 1);
+ if((q = strchr(reqbuf, '?'))) {
+ setenv("QUERY_STRING", q + 1, 1);
+ *q = '
Received on Thu Aug 14 2014 - 17:55:16 CEST
This archive was generated by hypermail 2.3.0
: Thu Aug 14 2014 - 18:00:12 CEST