From c57b4aedad6da937351beef5af4e14c1e76952fa Mon Sep 17 00:00:00 2001 From: zodiac Date: Thu, 15 Jan 2009 03:13:08 +0000 Subject: [PATCH] Make the CGI port and pid available to the web server. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@42 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- shellinabox/shellinaboxd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shellinabox/shellinaboxd.c b/shellinabox/shellinaboxd.c index 3459061..26904eb 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -893,7 +893,11 @@ int main(int argc, char * const argv[]) { char *cgiRoot; check(cgiRoot = malloc(cgiRootEnd - cgiRootStart + 1)); memcpy(cgiRoot, cgiRootStart, cgiRootEnd - cgiRootStart); - puts("Content-type: text/html; charset=utf-8\r\n\r"); + cgiRoot[cgiRootEnd - cgiRootStart] = '\000'; + printf("X-ShellInABox-Port: %d\r\n" + "X-ShellInABox-Pid: %d\r\n" + "Content-type: text/html; charset=utf-8\r\n\r\n", + port, pid); printf(cgiRoot, port, cgiSessionKey); fflush(stdout); free(cgiRoot);