]> granicus.if.org Git - php/commitdiff
Move path_info to the SAPI structure
authorZeev Suraski <zeev@php.net>
Sun, 2 May 1999 19:54:02 +0000 (19:54 +0000)
committerZeev Suraski <zeev@php.net>
Sun, 2 May 1999 19:54:02 +0000 (19:54 +0000)
cgi_main.c
ext/hyperwave/hw.c
ext/standard/info.c
main/fopen_wrappers.c
main/main.c
request_info.c

index 2fe4e50ecde768bdf0b55e342d4b0eeff287b741..792e2fe9c6ed7a5b41ef46babbab4b69c5796af6 100644 (file)
@@ -115,6 +115,13 @@ static void php_cgi_usage(char *argv0)
 }
 
 
+static void init_request_info(SLS_D)
+{
+       SG(request_info).query_string = getenv("QUERY_STRING");
+       SG(request_info).request_uri = getenv("PATH_INFO");
+}
+
+
 int main(int argc, char *argv[])
 {
        int cgi = 0, c, i, len;
@@ -293,7 +300,7 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine
 
        php3_TreatHeaders();
 
-       SG(request_info).query_string = getenv("QUERY_STRING");
+       init_request_info(SLS_C);
 
        if (!cgi) {
                if (!SG(request_info).query_string) {
index 8a813dde86b8ea06793f84578e72730f00327d78..f2380dde058b01d891ed6ea83c12fa3c4b9d6322 100644 (file)
@@ -1532,7 +1532,7 @@ void php3_hw_getcgi(INTERNAL_FUNCTION_PARAMETERS) {
 #else
        sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
                             request_info.request_method,
-                            request_info.path_info,
+                            SG(request_info).request_uri,
                             SG(request_info).query_string);
 #endif
        /* !!!! memory for object and attributes is allocated with malloc !!!! */
@@ -1784,7 +1784,7 @@ void php3_hw_pipecgi(INTERNAL_FUNCTION_PARAMETERS) {
 #else
        sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
                             request_info.request_method,
-                            request_info.path_info,
+                            SG(request_info).request_uri,
                             SG(request_info).query_string);
 #endif
        /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
index ceee00eb3ece4f7c320c66323a460766495b1b54..386b2d0abcf1d7d353af39d200ed0cdfbb814283 100644 (file)
@@ -88,6 +88,7 @@ PHPAPI void _php3_info(void)
 #endif
        ELS_FETCH();
        PLS_FETCH();
+       SLS_FETCH();
        
 #if WIN32|WINNT
        // Get build numbers for Windows NT or Win95
@@ -104,7 +105,9 @@ PHPAPI void _php3_info(void)
 
 
        PUTS("<img src=\"");
-       /*PUTS(r->uri);*/
+       if (SG(request_info).request_uri) {
+               PUTS(SG(request_info).request_uri);
+       }
        PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"56\" align=\"right\">\n");
        php3_printf("<center><h1>PHP Version %s</h1></center>\n", PHP_VERSION);
        PUTS("<p>by <a href=\"mailto:rasmus@lerdorf.on.ca\">Rasmus Lerdorf</a>,\n");
@@ -392,7 +395,9 @@ PHPAPI void _php3_info(void)
        PUTS("<table width=\"100%%\"><tr>\n");
        php3_printf("<td><h2>Zend</h2>This program makes use of the Zend scripting language engine:<br><pre>%s</pre></td>", get_zend_version());
        PUTS("<td width=\"100\"><a href=\"http://www.zend.com/\"><img src=\"");
-       /*PUTS(r->uri);*/
+       if (SG(request_info).request_uri) {
+               PUTS(SG(request_info).request_uri);
+       }
        PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"89\"></a></td>\n");
        PUTS("</tr></table>\n");
 
index 8b2814bf88956f77b5ce27e01cddee424228d89f..2a563c6bc7692ba2deef5aa380406c9139a9eb71 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "php.h"
 #include "php_globals.h"
+#include "SAPI.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -205,9 +206,10 @@ PHPAPI FILE *php3_fopen_for_parser(void)
        char *temp, *path_info, *fn;
        int l;
        PLS_FETCH();
+       SLS_FETCH();
 
        fn = request_info.filename;
-       path_info = request_info.path_info;
+       path_info = SG(request_info).request_uri;
 #if HAVE_PWD_H
        if (PG(user_dir) && *PG(user_dir)
                && path_info && '/' == path_info[0] && '~' == path_info[1]) {
index 7bef2e8af1e537cbc13e4a3bae67aae265bf92ce..a745601c47feeac649125dafe6c3fe142240c822 100644 (file)
@@ -1024,7 +1024,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                /* Build the special-case PHP_SELF variable for the CGI version */
                char *pi;
 #if FORCE_CGI_REDIRECT
-               pi = request_info.path_info;
+               pi = SG(request_info).request_uri;
                tmp = (pval *) emalloc(sizeof(pval));
                tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1);
                tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s", (pi ? pi : ""));   /* SAFE */
@@ -1035,7 +1035,7 @@ int _php3_hash_environment(PLS_D ELS_DC)
                int l = 0;
                char *sn;
                sn = request_info.script_name;
-               pi = request_info.path_info;
+               pi = SG(request_info).request_uri;
                if (sn)
                        l += strlen(sn);
                if (pi)
index 1045cbbcb488a0d777e7298bc578f42e2d7d2f88..7da4a9bf3445cfe83b824f0c69e4212daf8b42d0 100644 (file)
@@ -40,7 +40,6 @@ int php3_init_request_info(void *conf)
        char *buf;      /* temporary buffers */
        SLS_FETCH();
 
-       request_info.path_info = getenv("PATH_INFO");
        request_info.current_user = NULL;
        request_info.current_user_length = 0;
        request_info.request_method = getenv("REQUEST_METHOD");
@@ -122,27 +121,6 @@ int php3_init_request_info(void *conf)
 
 #endif
 
-#if USE_SAPI
-/* temporary until I figure a beter way to do it */
-int php3_init_request_info(void *conf)
-{
-       if (sapi_rqst->filename)
-               request_info.filename = estrdup(sapi_rqst->filename);
-       else
-               request_info.filename = NULL;
-       request_info.path_info = sapi_rqst->path_info;
-       request_info.current_user = sapi_rqst->current_user;
-       request_info.current_user_length = sapi_rqst->current_user_length;
-       request_info.request_method = sapi_rqst->request_method;
-       request_info.script_name = sapi_rqst->script_name;
-       request_info.content_length = sapi_rqst->content_length;
-       request_info.content_type = sapi_rqst->content_type;
-       request_info.cookies = sapi_rqst->cookies;
-
-       return SUCCESS;
-}
-#endif
-
 #if !CGI_BINARY
 int php3_destroy_request_info(void *conf)
 {