cvs: /php4 cgi_main.c main.c rfc1867.c /php4/ext/standard post.c post.h string.c
| From: | Zeev Suraski | Date: | Sat, 11 Sep 1999 14:09:30 +0000 |
| Subject: | cvs: /php4 cgi_main.c main.c rfc1867.c /php4/ext/standard post.c post.h string.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4321@lists.php.net to get a copy of this message | ||
zeev Sat Sep 11 10:09:30 1999 EDT
Modified files:
/php4 cgi_main.c main.c rfc1867.c
/php4/ext/standard post.c post.h string.c
Log:
Cleanups & optimizations
Index: php4/cgi_main.c
diff -u php4/cgi_main.c:1.28 php4/cgi_main.c:1.29
--- php4/cgi_main.c:1.28 Sun Sep 5 21:33:13 1999
+++ php4/cgi_main.c Sat Sep 11 10:09:29 1999
@@ -347,7 +347,6 @@
SG(headers_sent) = 1;
}
cgi_started=1;
- php3_TreatHeaders();
php_print_info(0xFFFFFFFF);
exit(1);
break;
@@ -403,8 +402,6 @@
file_handle.filename = "-";
file_handle.type = ZEND_HANDLE_FP;
file_handle.handle.fp = stdin;
-
- php3_TreatHeaders();
if (!cgi) {
Index: php4/main.c
diff -u php4/main.c:1.115 php4/main.c:1.116
--- php4/main.c:1.115 Mon Sep 6 18:40:26 1999
+++ php4/main.c Sat Sep 11 10:09:29 1999
@@ -19,7 +19,7 @@
*/
-/* $Id: main.c,v 1.115 1999/09/06 22:40:26 zeev Exp $ */
+/* $Id: main.c,v 1.116 1999/09/11 14:09:29 zeev Exp $ */
#include <stdio.h>
@@ -579,15 +579,17 @@
switch (message) {
case ZMSG_ENABLE_TRACK_VARS: {
int old;
+ ELS_FETCH();
PLS_FETCH();
+ SLS_FETCH();
old = PG(track_vars);
PG(track_vars) = 1;
if(old == 0) {
- php3_treat_data(PARSE_POST, NULL);
- php3_treat_data(PARSE_COOKIE, NULL);
- php3_treat_data(PARSE_GET, NULL);
+ php_treat_data(PARSE_POST, NULL ELS_CC PLS_CC SLS_CC);
+ php_treat_data(PARSE_COOKIE, NULL ELS_CC PLS_CC SLS_CC);
+ php_treat_data(PARSE_GET, NULL ELS_CC PLS_CC SLS_CC);
}
}
break;
@@ -943,12 +945,11 @@
/* in 3.1 some of this should move into sapi */
-int zend_hash_environment(PLS_D ELS_DC)
+static int zend_hash_environment(PLS_D ELS_DC SLS_DC)
{
char **env, *p, *t;
unsigned char _gpc_flags[3] = {0,0,0};
pval *tmp;
- SLS_FETCH();
p = PG(gpc_order);
while(*p) {
@@ -956,21 +957,21 @@
case 'p':
case 'P':
if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method
&& !strcasecmp(SG(request_info).request_method, "POST")) {
- php3_treat_data(PARSE_POST, NULL); /* POST Data */
+ php_treat_data(PARSE_POST, NULL ELS_CC PLS_CC SLS_CC); /* POST Data */
_gpc_flags[0]=1;
}
break;
case 'c':
case 'C':
if (!_gpc_flags[1]) {
- php3_treat_data(PARSE_COOKIE, NULL); /* Cookie Data */
+ php_treat_data(PARSE_COOKIE, NULL ELS_CC PLS_CC SLS_CC); /* Cookie Data */
_gpc_flags[1]=1;
}
break;
case 'g':
case 'G':
if (!_gpc_flags[2]) {
- php3_treat_data(PARSE_GET, NULL); /* GET Data */
+ php_treat_data(PARSE_GET, NULL ELS_CC PLS_CC SLS_CC); /* GET Data */
_gpc_flags[2]=1;
}
break;
@@ -1150,7 +1151,7 @@
if (setjmp(EG(bailout))!=0) {
return;
}
- zend_hash_environment(PLS_C ELS_CC);
+ zend_hash_environment(PLS_C ELS_CC SLS_CC);
#if WIN32||WINNT
UpdateIniFromRegistry(primary_file->filename);
@@ -1198,7 +1199,6 @@
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
return FAILURE;
}
- php3_TreatHeaders();
file_handle.type = ZEND_HANDLE_FD;
file_handle.handle.fd = fd;
file_handle.filename = SG(request_info).path_translated;
Index: php4/rfc1867.c
diff -u php4/rfc1867.c:1.8 php4/rfc1867.c:1.9
--- php4/rfc1867.c:1.8 Sat Sep 11 09:44:23 1999
+++ php4/rfc1867.c Sat Sep 11 10:09:29 1999
@@ -15,7 +15,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.8 1999/09/11 13:44:23 zeev Exp $ */
+/* $Id: rfc1867.c,v 1.9 1999/09/11 14:09:29 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -159,7 +159,7 @@
*(loc - 4) = '\0';
/* Magic function that figures everything out */
- php_parse_gpc_data(ptr,namebuf,http_post_vars);
+ php_parse_gpc_data(ptr,namebuf,http_post_vars ELS_CC PLS_CC);
/* And a little kludge to pick out special MAX_FILE_SIZE */
itype = php3_check_ident_type(namebuf);
Index: php4/ext/standard/post.c
diff -u php4/ext/standard/post.c:1.19 php4/ext/standard/post.c:1.20
--- php4/ext/standard/post.c:1.19 Sat Sep 11 09:44:23 1999
+++ php4/ext/standard/post.c Sat Sep 11 10:09:29 1999
@@ -33,14 +33,12 @@
* the old TreatData function. This is a temporary measure filling
* the gap until a more flexible parser can be built to do this.
*/
-void php_parse_gpc_data(char *val, char *var, pval *track_vars_array)
+void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_DC)
{
int var_type;
char *ind, *tmp = NULL, *ret = NULL;
int var_len, val_len;
pval *entry;
- ELS_FETCH();
- PLS_FETCH();
var_type = php3_check_ident_type(var);
if (var_type == GPC_INDEXED_ARRAY) {
@@ -176,14 +174,11 @@
}
-void php3_treat_data(int arg, char *str)
+void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC)
{
char *res = NULL, *var, *val;
pval *array_ptr;
int free_buffer=0;
- ELS_FETCH();
- PLS_FETCH();
- SLS_FETCH();
switch (arg) {
case PARSE_POST:
@@ -255,7 +250,7 @@
/* FIXME: XXX: not binary safe, discards returned length */
_php3_urldecode(var, strlen(var));
_php3_urldecode(val, strlen(val));
- php_parse_gpc_data(val,var,array_ptr);
+ php_parse_gpc_data(val,var,array_ptr ELS_CC PLS_CC);
}
if (arg == PARSE_COOKIE) {
var = strtok(NULL, ";");
@@ -270,106 +265,6 @@
}
}
-
-PHPAPI void php3_TreatHeaders(void)
-{
-#if 0
-#if APACHE
-#if MODULE_MAGIC_NUMBER > 19961007
- const char *s = NULL;
-#else
- char *s = NULL;
-#endif
- char *t;
- char *user, *type;
- int len;
- char *escaped_str;
- request_rec *r;
- PLS_FETCH();
- SLS_FETCH();
-
- r = ((request_rec *) SG(server_context));
-
- if (r->headers_in)
- s = table_get(r->headers_in, "Authorization");
- if (!s)
- return;
-
- /* Check to make sure that this URL isn't authenticated
- using a traditional auth module mechanism */
- if (auth_type(r)) {
- /*php_error(E_WARNING, "Authentication done by server module\n");*/
- return;
- }
- if (strcmp(t=getword(r->pool, &s, ' '), "Basic")) {
- /* Client tried to authenticate using wrong auth scheme */
- php_error(E_WARNING, "client used wrong authentication scheme (%s)", t);
- return;
- }
- t = uudecode(r->pool, s);
-#if MODULE_MAGIC_NUMBER > 19961007
- user = getword_nulls_nc(r->pool, &t, ':');
-#else
- user = getword(r->pool, &t, ':');
-#endif
- type = "Basic";
-
- if (user) {
- if (PG(magic_quotes_gpc)) {
- escaped_str = php_addslashes(user, 0, &len, 0);
- SET_VAR_STRINGL("PHP_AUTH_USER", escaped_str, len);
- } else {
- SET_VAR_STRING("PHP_AUTH_USER", estrdup(user));
- }
- }
- if (t) {
- if (PG(magic_quotes_gpc)) {
- escaped_str = php_addslashes(t, 0, &len, 0);
- SET_VAR_STRINGL("PHP_AUTH_PW", escaped_str, len);
- } else {
- SET_VAR_STRING("PHP_AUTH_PW", estrdup(t));
- }
- }
- if (type) {
- if (PG(magic_quotes_gpc)) {
- escaped_str = php_addslashes(type, 0, &len, 0);
- SET_VAR_STRINGL("PHP_AUTH_TYPE", escaped_str, len);
- } else {
- SET_VAR_STRING("PHP_AUTH_TYPE", estrdup(type));
- }
- }
-#endif
-#if FHTTPD
- int i,len;
- struct rline *l;
- char *type;
- char *escaped_str;
-
- if(req && req->remote_user){
- for(i=0; i < req->nlines; i++){
- l=req->lines+i;
- if((l->paramc > 1)&&!strcasecmp(l->params[0], "REMOTE_PW")){
- type = "Basic";
- if (PG(magic_quotes_gpc)) {
- escaped_str = php_addslashes(type, 0, &len, 0);
- SET_VAR_STRINGL("PHP_AUTH_TYPE", escaped_str, len);
- escaped_str = php_addslashes(l->params[1], 0, &len, 0);
- SET_VAR_STRINGL("PHP_AUTH_PW", escaped_str, len);
- escaped_str = php_addslashes(req->remote_user, 0, &len, 0);
- SET_VAR_STRINGL("PHP_AUTH_USER", escaped_str, len);
-
- } else {
- SET_VAR_STRING("PHP_AUTH_TYPE", estrdup(type));
- SET_VAR_STRING("PHP_AUTH_PW", estrdup(l->params[1]));
- SET_VAR_STRING("PHP_AUTH_USER", estrdup(req->remote_user));
- }
- i=req->nlines;
- }
- }
- }
-#endif
-#endif
-}
/*
* Local variables:
Index: php4/ext/standard/post.h
diff -u php4/ext/standard/post.h:1.3 php4/ext/standard/post.h:1.4
--- php4/ext/standard/post.h:1.3 Sat Sep 11 09:44:23 1999
+++ php4/ext/standard/post.h Sat Sep 11 10:09:29 1999
@@ -26,18 +26,19 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: post.h,v 1.3 1999/09/11 13:44:23 zeev Exp $ */
+/* $Id: post.h,v 1.4 1999/09/11 14:09:29 zeev Exp $ */
#ifndef _POST_H
#define _POST_H
+#include "SAPI.h"
+
#define PARSE_POST 0
#define PARSE_GET 1
#define PARSE_COOKIE 2
#define PARSE_STRING 3
-void php3_treat_data(int arg, char *str);
-void php_parse_gpc_data(char *, char *, pval *track_vars_array);
-PHPAPI void php3_TreatHeaders(void);
+void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC);
+void php_parse_gpc_data(char *val, char *var, pval *track_vars_array ELS_DC PLS_DC);
#endif
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.35 php4/ext/standard/string.c:1.36
--- php4/ext/standard/string.c:1.35 Tue Sep 7 16:29:31 1999
+++ php4/ext/standard/string.c Sat Sep 11 10:09:29 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.35 1999/09/07 20:29:31 andi Exp $ */
+/* $Id: string.c,v 1.36 1999/09/11 14:09:29 zeev Exp $ */
/* Synced with php3 revision 1.193 1999-06-16 [ssb] */
@@ -1873,6 +1873,9 @@
{
pval *arg;
char *res = NULL;
+ ELS_FETCH();
+ PLS_FETCH();
+ SLS_FETCH();
if (getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -1881,7 +1884,7 @@
if (arg->value.str.val && *arg->value.str.val) {
res = estrndup(arg->value.str.val,arg->value.str.len);
}
- php3_treat_data(PARSE_STRING, res);
+ php_treat_data(PARSE_STRING, res ELS_CC PLS_CC SLS_CC);
}
/* }}} */