call[fs]cgi: Ensure less delay in closing stdin when shutting down.
[ashd.git] / src / callfcgi.c
index 1ff521e..9af5929 100644 (file)
@@ -465,8 +465,8 @@ static void mkcgienv(struct hthead *req, struct charbuf *dst)
     } else {
        bufaddenv(dst, "SCRIPT_NAME", "%s", url);
     }
-    free(url);
     bufaddenv(dst, "QUERY_STRING", "%s", qp?qp:"");
+    free(url);
     if((h = getheader(req, "Host")) != NULL)
        bufaddenv(dst, "SERVER_NAME", "%s", h);
     if((h = getheader(req, "X-Ash-Server-Port")) != NULL)
@@ -806,6 +806,7 @@ static void sigign(int sig)
 
 static void sigexit(int sig)
 {
+    shutdown(0, SHUT_RDWR);
     exit(0);
 }