From f1825130091183ecee7802ce352b2dafa1fe8ff7 Mon Sep 17 00:00:00 2001 From: Brad Metcalf Date: Tue, 31 Mar 2015 23:56:27 -0500 Subject: [PATCH] Port information supplied to ENV variables --- lib/bridge.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bridge.js b/lib/bridge.js index 75fb9e0..f9a764a 100644 --- a/lib/bridge.js +++ b/lib/bridge.js @@ -34,7 +34,7 @@ function runPHP(req, response, next, phpinfo){ PW_MANIFEST: phpinfo.manifest, PW_APP_PATH: process.cwd(), PW_SERVER_HOST: phpinfo.host, - PW_SERVER_PORT: phpinfo.port, + PW_SERVER_PORT: (phpinfo.port == 0 ? req.connection.localPort : phpinfo.port), PATH_INFO: pathinfo, //The extra path information, as given in the requested URL. In fact, scripts can be accessed by their virtual path, followed by extra information at the end of this path. The extra information is sent in PATH_INFO. PATH_TRANSLATED: "", //The virtual-to-real mapped version of PATH_INFO. SCRIPT_NAME: parts.pathname, //The virtual path of the script being executed. @@ -56,11 +56,11 @@ function runPHP(req, response, next, phpinfo){ SERVER_SOFTWARE: "php-webkit", //The web server's software identity. SERVER_NAME: phpinfo.host, //The host name or the IP address of the computer running the web server as given in the requested URL. SERVER_ADDR: phpinfo.host, //The IP address of the computer running the web server. - SERVER_PORT: phpinfo.port, //The port to which the request was sent. + SERVER_PORT: (phpinfo.port == 0 ? req.connection.localPort : phpinfo.port), //The port to which the request was sent. GATEWAY_INTERFACE: "CGI/1.1", //The CGI Specification version supported by the web server; always set to CGI/1.1. SERVER_PROTOCOL: "", //The HTTP protocol version used by the current request. REMOTE_ADDR: req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAddress || req.connection.socket.remoteAddress || "", //The IP address of the computer that sent the request. - REMOTE_PORT: "", //The port from which the request was sent. + REMOTE_PORT: req.connection.remotePort, //The port from which the request was sent. DOCUMENT_ROOT: "", //The absolute path of the web site files. It has the same value as Documents Path. INSTANCE_ID: "", //The numerical identifier of the host which served the request. On Abyss Web Server X1, it is always set to 1 since there is only a single host. APPL_MD_PATH: "", //The virtual path of the deepest alias which contains the request URI. If no alias contains the request URI, the variable is set to /.