Added CGI session key in HTTP response header

* Session key is returned in first HTTP response if CGI mode is used.
  Header filed is named 'X-ShellInABox-Session'. This can be used by
  some special applications that need unique token.
This commit is contained in:
KLuka 2015-09-03 18:04:05 +02:00
parent 8d3c5cdc3d
commit b58542eb99

View file

@ -1372,8 +1372,9 @@ int main(int argc, char * const argv[]) {
check(port = serverGetListeningPort(server)); check(port = serverGetListeningPort(server));
printf("X-ShellInABox-Port: %d\r\n" printf("X-ShellInABox-Port: %d\r\n"
"X-ShellInABox-Pid: %d\r\n" "X-ShellInABox-Pid: %d\r\n"
"X-ShellInABox-Session: %s\r\n"
"Content-type: text/html; charset=utf-8\r\n\r\n", "Content-type: text/html; charset=utf-8\r\n\r\n",
port, getpid()); port, getpid(), cgiSessionKey);
UNUSED(cgiRootSize); UNUSED(cgiRootSize);
printfUnchecked(cgiRootStart, port, cgiSessionKey); printfUnchecked(cgiRootStart, port, cgiSessionKey);
fflush(stdout); fflush(stdout);