commit 2822488312805fd2b02a43fc71ad7c81f39c2a98
Author: Hiltjo Posthuma <[email protected]>
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
@@ -307,6 +307,7 @@ void
 responsecgi(void) {
        FILE *cgi;
        size_t r;
+       char *q;
 
        if (req.type == GET)
                setenv("REQUEST_METHOD", "GET", 1);
@@ -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 = '

Reply via email to