summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-05-02 19:54:02 +0000
committerZeev Suraski <zeev@php.net>1999-05-02 19:54:02 +0000
commita5ab6b9638c76748f7b9b66ebbd4d8cacf682250 (patch)
tree68c045f85fd7ea5fd8c20d2d460180392352be31
parent7071131f81c53b5ff062f724a0aa758a5138e012 (diff)
downloadphp-git-a5ab6b9638c76748f7b9b66ebbd4d8cacf682250.tar.gz
Move path_info to the SAPI structure
-rw-r--r--cgi_main.c9
-rw-r--r--ext/hyperwave/hw.c4
-rw-r--r--ext/standard/info.c9
-rw-r--r--main/fopen_wrappers.c4
-rw-r--r--main/main.c4
-rw-r--r--request_info.c22
6 files changed, 22 insertions, 30 deletions
diff --git a/cgi_main.c b/cgi_main.c
index 2fe4e50ecd..792e2fe9c6 100644
--- a/cgi_main.c
+++ b/cgi_main.c
@@ -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) {
diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c
index 8a813dde86..f2380dde05 100644
--- a/ext/hyperwave/hw.c
+++ b/ext/hyperwave/hw.c
@@ -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 !!!! */
diff --git a/ext/standard/info.c b/ext/standard/info.c
index ceee00eb3e..386b2d0abc 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -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");
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 8b2814bf88..2a563c6bc7 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -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]) {
diff --git a/main/main.c b/main/main.c
index 7bef2e8af1..a745601c47 100644
--- a/main/main.c
+++ b/main/main.c
@@ -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)
diff --git a/request_info.c b/request_info.c
index 1045cbbcb4..7da4a9bf34 100644
--- a/request_info.c
+++ b/request_info.c
@@ -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)
{