Commit 7348cb57 authored by deuce's avatar deuce
Browse files

Use getsockname() to read the server port since we don't know that it's

the same as startup->port anymore.
parent a0c1bea1
......@@ -761,9 +761,12 @@ static void add_env(http_session_t *session, const char *name,const char *value)
/***************************************/
static void init_enviro(http_session_t *session) {
char str[128];
union xp_sockaddr sockaddr;
socklen_t socklen = sizeof(sockaddr);
add_env(session,"SERVER_SOFTWARE",VERSION_NOTICE);
sprintf(str,"%d",startup->port);
getsockname(session->socket, &sockaddr.addr, &socklen);
sprintf(str,"%d",inet_addrport(&sockaddr));
add_env(session,"SERVER_PORT",str);
add_env(session,"GATEWAY_INTERFACE","CGI/1.1");
if(!strcmp(session->host_name,session->host_ip))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment