bufaddenv(dst, "SERVER_NAME", "%s", h);
if((h = getheader(req, "X-Ash-Server-Port")) != NULL)
bufaddenv(dst, "SERVER_PORT", "%s", h);
- if(((h = getheader(req, "X-Ash-Server-Protocol")) != NULL) && !strcmp(h, "https"))
+ if(((h = getheader(req, "X-Ash-Protocol")) != NULL) && !strcmp(h, "https"))
bufaddenv(dst, "HTTPS", "on");
if((h = getheader(req, "X-Ash-Address")) != NULL)
bufaddenv(dst, "REMOTE_ADDR", "%s", h);
}
}
+static void sigexit(int sig)
+{
+ exit(0);
+}
+
static void usage(FILE *out)
{
fprintf(out, "usage: servescgi [-h] [-N RETRIES] [-i ID] [-u UNIX-PATH] [-t [HOST:]TCP-PORT] [PROGRAM [ARGS...]]\n");
exit(1);
}
signal(SIGCHLD, SIG_IGN);
+ signal(SIGINT, sigexit);
+ signal(SIGTERM, sigexit);
mustart(listenloop, 0);
atexit(killcuraddr);
ioloop();