Re: [PATCH] sapi/nsapi/nsapi.c

From: Date: Mon, 03 Feb 2003 19:14:23 +0000
Subject: Re: [PATCH] sapi/nsapi/nsapi.c
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-93961@lists.php.net to get a copy of this message
Excelent, The CGI vars are correct. One less sapi module to deal with :) Shane Uwe Schindler wrote:
The variables you explain are surely there. But a lot of scripts depend on other headers, which the client sent. The SAPI module only creates Variables for a subset of them (HTTP_USER_AGENT). But not for all like the other SAPI modules. So with this patch you get for example the missing HTTP_HOST-Header (HTTP/1.1) because the patch creates for every variable in the request a HTTP_XXX-Variable. So you can see all headers the client have sent. This is the way the other SAPI modules (APACHE) and the normal CGI environment works. Without it about 50% of the currently available PHP scripts do not run correctly. You can try it with: http://www.emarcon.net/test.php which runs the patched Version. Yo will see all headers sent by your client not only the ones explained below and HTTP_USER_AGENT and HTTP_ACCEPT_* Greetings from Germany, Uwe At 15:52 02.02.2003 -0800, you wrote:
Hi Uwe, I haven't looked at the patch, but I am wondering if the nsapi sapi module creates variables for php that conform to the cgi spec. Can you try the following url against a phpinfo(); script: http://localhost/info.php/test/path?query=string You should get: PATH_INFO=/test/path PATH_TRANSLATED=/your_web_document_root/test/path QUERY_STRING=query=string SCRIPT_NAME=/info.php PHP_SELF=/info.php If you do not, then the sapi module is not conformant to cgi spec, and still needs some work. Shane Uwe Schindler wrote:
I submit a patch for the NSAPI SAPI module and hope that it fixes a lot of problems I have (and others as seen in the bug database). As a lot of variables which are needed by a lot of PHP scripts which use $_SERVER["..."] are not transferred correctly to the PHP script that runs in iPlanet Webserver (4 or 6). An example are the "Host" and "X-Forwarded" headers. This is so, because the transferred variables are static in the SAPI module. The new nsapi.c file now transfers _ALL_ variables from rc->rq->headers to php_register_variable("HTTP_"+headername_uppercase, ...). Also missing variables like "SERVER_SOFTWARE" are added. A lot of customers complain about memory leaks in this module. I hope they are also fixed by freeing the by nsapi allocated strings (the return value of session_dns and http_uri2url). The patch should work with Netscape/iPlanet Servers from version 3 on (I used no newer API calls). If you are interested I could eventually create a patch for supporting the "virtual servers" in SunONE/iPlanet Web Server 6, because some vars only get the default-hostname not the real virtual server name (for example $_SERVER["SERVER_URL"] which is often used in scripts to refer together with $_SERVER["PHP_SELF"]). But this mut be done with #ifdefs because some new functions are in the nsapi since version 6. A good fix would be also to map $_SERVER["SERVER_URL"] to "http://$SERVER["HTTP_HOST"]", because in iPlanet-Servers the Host variable is everytime available (if not in original HTTP-headers it is defined to be the default hostname). Greetings, Uwe ----- Uwe Schindler Addr 1: Bamberger Str. 24a, D-96049 Bamberg Addr 2: Drausnickstr. 153, D-91052 Erlangen http://www.thetaphi.de - http:///www.schindlers-software.de eMails: uwe@thetaphi.de (private); info@schindlers-software.de (company) Tel./Fax: +49 700 PCLATEIN (+49 700 72528346) Schindlers Software - Home of Schindlers PC-LATEIN 3.10 DIE Software zum Lateinlernen!
----- Uwe Schindler Addr 1: Bamberger Str. 24a, D-96049 Bamberg Addr 2: Drausnickstr. 153, D-91052 Erlangen http://www.thetaphi.de - http:///www.schindlers-software.de eMails: uwe@thetaphi.de (private); info@schindlers-software.de (company) Tel./Fax: +49 700 PCLATEIN (+49 700 72528346) Schindlers Software - Home of Schindlers PC-LATEIN 3.10 DIE Software zum Lateinlernen!


« previous php.dev (#93961) next »