[PHP4BETA] CVS update: php4/ext/standard

From: Date: Mon, 26 Apr 1999 17:26:36 +0000
Subject: [PHP4BETA] CVS update: php4/ext/standard
Groups: php.version4 
Request: Send a blank email to php-version4+get-558@lists.php.net to get a copy of this message
Date: Monday April 26, 1999 @ 13:26 Author: zeev Update of /repository/php4/ext/standard In directory php:/tmp/cvs-serv18494/ext/standard Modified Files: basic_functions.c exec.c head.c info.c pageinfo.c post.c Log Message: * Get the Apache module to compile again * Get rid of php3_rqst, use SG(server_context) instead (there's still Apache-specific code, but it nuked a global) Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.8 php4/ext/standard/basic_functions.c:1.9 --- php4/ext/standard/basic_functions.c:1.8 Mon Apr 26 10:00:48 1999 +++ php4/ext/standard/basic_functions.c Mon Apr 26 13:26:36 1999 @@ -56,6 +56,7 @@ #include "zend_globals.h" #include "php_globals.h" +#include "SAPI.h" static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE }; static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE }; @@ -396,6 +397,7 @@ #endif pval *str; char *ptr; + SLS_FETCH(); if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) { WRONG_PARAM_COUNT; @@ -423,7 +425,7 @@ if (str->type == IS_STRING && #if APACHE - ((ptr = (char *)table_get(php3_rqst->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val))) + ((ptr = (char *)table_get(((request_rec *) SG(server_context))->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val))) #endif #if CGI_BINARY (ptr = getenv(str->value.str.val)) @@ -1166,11 +1168,13 @@ void php3_flush(INTERNAL_FUNCTION_PARAMETERS) #endif { + SLS_FETCH(); + #if APACHE # if MODULE_MAGIC_NUMBER > 19970110 - rflush(php3_rqst); + rflush(((request_rec *) SG(server_context))); # else - bflush(php3_rqst->connection->client); + bflush(((request_rec *) SG(server_context))->connection->client); # endif #endif #if FHTTPD Index: php4/ext/standard/exec.c diff -u php4/ext/standard/exec.c:1.6 php4/ext/standard/exec.c:1.7 --- php4/ext/standard/exec.c:1.6 Fri Apr 23 20:11:56 1999 +++ php4/ext/standard/exec.c Mon Apr 26 13:26:36 1999 @@ -26,7 +26,7 @@ | Author: Rasmus Lerdorf | +----------------------------------------------------------------------+ */ -/* $Id: exec.c,v 1.6 1999/04/24 00:11:56 zeev Exp $ */ +/* $Id: exec.c,v 1.7 1999/04/26 17:26:36 zeev Exp $ */ #include <stdio.h> #include "php.h" @@ -36,6 +36,7 @@ #include "ext/standard/head.h" #include "exec.h" #include "php_globals.h" +#include "SAPI.h" #if HAVE_SYS_WAIT_H #include <sys/wait.h> @@ -118,12 +119,14 @@ if (type != 3) { while (fgets(buf, EXEC_INPUT_BUF - 1, fp)) { if (type == 1) { + SLS_FETCH(); + if (output) PUTS(buf); #if APACHE # if MODULE_MAGIC_NUMBER > 19970110 - if (output) rflush(php3_rqst); + if (output) rflush(((request_rec *) SG(server_context))); # else - if (output) bflush(php3_rqst->connection->client); + if (output) bflush(((request_rec *) SG(server_context))->connection->client); # endif #endif #if CGI_BINARY Index: php4/ext/standard/head.c diff -u php4/ext/standard/head.c:1.6 php4/ext/standard/head.c:1.7 --- php4/ext/standard/head.c:1.6 Mon Apr 26 10:00:49 1999 +++ php4/ext/standard/head.c Mon Apr 26 13:26:36 1999 @@ -26,11 +26,12 @@ | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: head.c,v 1.6 1999/04/26 14:00:49 zeev Exp $ */ +/* $Id: head.c,v 1.7 1999/04/26 17:26:36 zeev Exp $ */ #include <stdio.h> #include "php.h" #include "ext/standard/php3_standard.h" +#include "SAPI.h" #include "main.h" #include "head.h" #include "post.h" @@ -84,6 +85,10 @@ char *temp = NULL; long myuid = 0L; char temp2[32]; + request_rec *req; + SLS_FETCH(); + + req = ((request_rec *) SG(server_context)); #endif if (php3_HeaderPrinted == 1) { @@ -104,10 +109,10 @@ *r = '\0'; if (!strcasecmp(header_information, "Content-type")) { if (*(r + 1) == ' ') - php3_rqst->content_type = pstrdup(php3_rqst->pool,r + 2); + req->content_type = pstrdup(req->pool,r + 2); else - php3_rqst->content_type = pstrdup(php3_rqst->pool,r + 1); - cont_type = (char *)php3_rqst->content_type; + req->content_type = pstrdup(req->pool,r + 1); + cont_type = (char *) req->content_type; } else { if (*(r + 1) == ' ') { rr = r + 2; @@ -126,26 +131,26 @@ temp = _php3_regreplace("$", temp2, rr, 0, 0); } } - table_set(php3_rqst->headers_out, header_information, temp); + table_set(req->headers_out, header_information, temp); } else - table_set(php3_rqst->headers_out, header_information, rr); + table_set(req->headers_out, header_information, rr); } if (!strcasecmp(header_information, "location")) { - php3_rqst->status = REDIRECT; + req->status = REDIRECT; } *r = ':'; php3_HeaderPrinted = 2; } if (!strncasecmp(header_information, "http/", 5)) { if (strlen(header_information) > 9) { - php3_rqst->status = atoi(&((header_information)[9])); + req->status = atoi(&((header_information)[9])); } /* Use a pstrdup here to get the memory straight from Apache's per-request pool to * avoid having our own memory manager complain about this memory not being freed * because it really shouldn't be freed until the end of the request and it isn't * easy for us to figure out when we allocated it vs. when something else might have. */ - php3_rqst->status_line = pstrdup(php3_rqst->pool,&((header_information)[9])); + req->status_line = pstrdup(req->pool,&((header_information)[9])); } #else r = strchr(header_information, ':'); @@ -230,12 +235,13 @@ CookieList *cookie; int len = 0; time_t t; - char *dt, *cookievalue = NULL; + char *dt, *cookievalue = NULL; #endif #if APACHE || defined(USE_SAPI) || FHTTPD char *tempstr; #endif PLS_FETCH(); + SLS_FETCH(); if (PG(header_is_being_sent)) { return 0; @@ -244,7 +250,7 @@ } #if APACHE - if (!php3_rqst) { /* we're not in a request, allow output */ + if (!((request_rec *) SG(server_context))) { /* we're not in a request, allow output */ PG(header_is_being_sent) = 0; return 1; } @@ -305,7 +311,7 @@ if (cookie->secure) { strcat(tempstr, "; secure"); } - table_add(php3_rqst->headers_out, "Set-Cookie", tempstr); + table_add(((request_rec *) SG(server_context))->headers_out, "Set-Cookie", tempstr); if (cookie->domain) efree(cookie->domain); if (cookie->path) efree(cookie->path); if (cookie->name) efree(cookie->name); @@ -317,8 +323,8 @@ } php3_HeaderPrinted = 1; header_called = 1; - send_http_header(php3_rqst); - if (php3_rqst->header_only) { + send_http_header(((request_rec *) SG(server_context))); + if (((request_rec *) SG(server_context))->header_only) { set_header_request(1); PG(header_is_being_sent) = 0; return(0); Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.7 php4/ext/standard/info.c:1.8 --- php4/ext/standard/info.c:1.7 Mon Apr 26 10:00:49 1999 +++ php4/ext/standard/info.c Mon Apr 26 13:26:36 1999 @@ -33,6 +33,7 @@ #include "php_globals.h" #include "ext/standard/head.h" #include "info.h" +#include "SAPI.h" #ifndef MSVC5 #include "build-defs.h" #endif @@ -88,7 +89,6 @@ ELS_FETCH(); PLS_FETCH(); - #if WIN32|WINNT // Get build numbers for Windows NT or Win95 if (dwVersion < 0x80000000){ @@ -104,7 +104,7 @@ PUTS("<img src=\""); - /*PUTS(php3_rqst->uri);*/ + /*PUTS(r->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"); @@ -321,9 +321,15 @@ #if APACHE { register int i; - array_header *arr = table_elts(php3_rqst->subprocess_env); - table_entry *elts = (table_entry *)arr->elts; - + array_header *arr; + table_entry *elts; + request_rec *r; + SLS_FETCH(); + + r = ((request_rec *) SG(server_context)); + arr = table_elts(r->subprocess_env); + elts = (table_entry *)arr->elts; + SECTION("Apache Environment"); PUTS("<table border=5 width=\"600\">\n"); PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Variable</th><th bgcolor=\"" HEADER_COLOR "\">Value</th></tr>\n"); @@ -343,14 +349,17 @@ array_header *env_arr; table_entry *env; int i; - + request_rec *r; + SLS_FETCH(); + + r = ((request_rec *) SG(server_context)); SECTION("HTTP Headers Information"); PUTS("<table border=5 width=\"600\">\n"); PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Request Headers</th></tr>\n"); PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP Request</td><td bgcolor=\"" CONTENTS_COLOR "\">"); - PUTS(php3_rqst->the_request); + PUTS(r->the_request); PUTS("&nbsp;</td></tr>\n"); - env_arr = table_elts(php3_rqst->headers_in); + env_arr = table_elts(r->headers_in); env = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { @@ -362,7 +371,7 @@ } } PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Response Headers</th></tr>\n"); - env_arr = table_elts(php3_rqst->headers_out); + env_arr = table_elts(r->headers_out); env = (table_entry *)env_arr->elts; for(i = 0; i < env_arr->nelts; ++i) { if (env[i].key) { @@ -383,7 +392,7 @@ 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(php3_rqst->uri);*/ + /*PUTS(r->uri);*/ PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"89\"></a></td>\n"); PUTS("</tr></table>\n"); Index: php4/ext/standard/pageinfo.c diff -u php4/ext/standard/pageinfo.c:1.3 php4/ext/standard/pageinfo.c:1.4 --- php4/ext/standard/pageinfo.c:1.3 Fri Apr 23 20:11:56 1999 +++ php4/ext/standard/pageinfo.c Mon Apr 26 13:26:36 1999 @@ -26,10 +26,11 @@ | Authors: Jim Winstead <jimw@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: pageinfo.c,v 1.3 1999/04/24 00:11:56 zeev Exp $ */ +/* $Id: pageinfo.c,v 1.4 1999/04/26 17:26:36 zeev Exp $ */ #include "php.h" #include "pageinfo.h" +#include "SAPI.h" #include <stdio.h> #include <stdlib.h> @@ -59,6 +60,11 @@ #if !APACHE char *path; struct stat sb; +#else + request_rec *r; + SLS_FETCH(); + + r = ((request_rec *) SG(server_context)); #endif #if APACHE @@ -67,9 +73,9 @@ values. We can afford it, and it means we don't have to worry about resetting the static variables after every hit. */ - page_uid = php3_rqst->finfo.st_uid; - page_inode = php3_rqst->finfo.st_ino; - page_mtime = php3_rqst->finfo.st_mtime; + page_uid = r ->finfo.st_uid; + page_inode = r->finfo.st_ino; + page_mtime = r->finfo.st_mtime; #else if (page_uid == -1) { path = request_info.filename; Index: php4/ext/standard/post.c diff -u php4/ext/standard/post.c:1.4 php4/ext/standard/post.c:1.5 --- php4/ext/standard/post.c:1.4 Mon Apr 26 10:00:49 1999 +++ php4/ext/standard/post.c Mon Apr 26 13:26:36 1999 @@ -32,6 +32,7 @@ #include "php.h" #include "php3_standard.h" #include "php_globals.h" +#include "SAPI.h" #include "zend_globals.h" @@ -54,6 +55,7 @@ int file_upload = 0; char *mb; char boundary[100]; + SLS_FETCH(); ctype = request_info.content_type; if (!ctype) { @@ -92,29 +94,29 @@ buf[length]=0; #else #if MODULE_MAGIC_NUMBER > 19961007 - if (should_client_block(php3_rqst)) { + if (should_client_block(SG(server_context))) { void (*handler) (int); int dbsize, len_read, dbpos = 0; - hard_timeout("copy script args", php3_rqst); /* start timeout timer */ + hard_timeout("copy script args", ((request_rec *) SG(server_context))); /* start timeout timer */ handler = signal(SIGPIPE, SIG_IGN); /* Ignore sigpipes for now */ - while ((len_read = get_client_block(php3_rqst, argsbuffer, HUGE_STRING_LEN)) > 0) { + while ((len_read = get_client_block(((request_rec *) SG(server_context)), argsbuffer, HUGE_STRING_LEN)) > 0) { if ((dbpos + len_read) > length) dbsize = length - dbpos; else dbsize = len_read; - reset_timeout(php3_rqst); /* Make sure we don't timeout */ + reset_timeout(((request_rec *) SG(server_context))); /* Make sure we don't timeout */ memcpy(buf + dbpos, argsbuffer, dbsize); dbpos += dbsize; } signal(SIGPIPE, handler); /* restore normal sigpipe handling */ - kill_timeout(php3_rqst); /* stop timeout timer */ + kill_timeout(((request_rec *) SG(server_context))); /* stop timeout timer */ } #else cnt = 0; do { #if APACHE - bytes = read_client_block(php3_rqst, buf + cnt, length - cnt); + bytes = read_client_block(((request_rec *) SG(server_context)), buf + cnt, length - cnt); #endif #if CGI_BINARY bytes = fread(buf + cnt, 1, length - cnt, stdin); @@ -405,29 +407,33 @@ char *user, *type; int len; char *escaped_str; + request_rec *r; PLS_FETCH(); + SLS_FETCH(); - if (php3_rqst->headers_in) - s = table_get(php3_rqst->headers_in, "Authorization"); + 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(php3_rqst)) { + if (auth_type(r)) { /*php3_error(E_WARNING, "Authentication done by server module\n");*/ return; } - if (strcmp(t=getword(php3_rqst->pool, &s, ' '), "Basic")) { + if (strcmp(t=getword(r->pool, &s, ' '), "Basic")) { /* Client tried to authenticate using wrong auth scheme */ php3_error(E_WARNING, "client used wrong authentication scheme (%s)", t); return; } - t = uudecode(php3_rqst->pool, s); + t = uudecode(r->pool, s); #if MODULE_MAGIC_NUMBER > 19961007 - user = getword_nulls_nc(php3_rqst->pool, &t, ':'); + user = getword_nulls_nc(r->pool, &t, ':'); #else - user = getword(php3_rqst->pool, &t, ':'); + user = getword(r->pool, &t, ':'); #endif type = "Basic"; -- PHP 4 Beta

« previous php.version4 (#558) next »