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
This commit is contained in:
zodiac 2009-01-15 03:13:08 +00:00
parent 537d83a5b1
commit c57b4aedad

View file

@ -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);