From b08f85aeef38aee4aeab1ad46efd8ebd29741d68 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sun, 13 Feb 2000 01:14:45 +0000 Subject: [PATCH] Make all of the ISAPI variables register themselves as Server variables --- NEWS | 4 ++-- sapi/isapi/php4isapi.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 90d3c8c14d..ae1716a0ed 100644 --- a/NEWS +++ b/NEWS @@ -6,7 +6,7 @@ PHP 4.0 NEWS - Made foreach() work on objects. (Thies, Zend library) - Added domxml extension based on libxml, still little functionality (Uwe) - Fixed memory corruption in fgetss(), strip_tags() and gzgetss() (Zeev) -- Updated calendar dynamic library to work with PHP4. (Evan) +- Updated calendar dynamic library to work with PHP 4. (Evan) - Added strncmp() function, courtesy of Walter. (Andrei) - Made the output of var_dump() more informative. (Thies) - Fixed some OCIBindByName() problems. (Thies) @@ -209,7 +209,7 @@ November 16 1999, Version 4.0 Beta 3 - OCI8 connections are now kept open as long as they are referenced (Thies) - Cleaned up Directory-Module (Thies) - Small fix in Ora_Close (Thies) -- Ported range() and shuffle() from PHP3 to PHP4 (Andrei) +- Ported range() and shuffle() from PHP 3 to PHP 4 (Andrei) - Fixed header("HTTP/..."); behaviour (Sascha) - Improved UNIX build system. Now utilizes libtool (Sascha) - Upgrade some more internal functions to use new Zend function API. (Thies, diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 5277f93e3e..72ba226b3d 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -299,9 +299,31 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC S char *variable; char *strtok_buf = NULL; LPEXTENSION_CONTROL_BLOCK lpECB; + char **p = isapi_server_variables; lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context); + /* Register the standard ISAPI variables */ + while (*p) { + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len) + && static_variable_buf[0]) { + php_register_variable(*p, static_variable_buf, track_vars_array ELS_CC PLS_CC); + } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + variable_buf = (char *) emalloc(variable_len); + if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len) + && variable_buf[0]) { + php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC); + } + efree(variable_buf); + } + p++; + } + + /* Register the internal bits of ALL_HTTP */ + + variable_len = ISAPI_SERVER_VAR_BUF_SIZE; + if (lpECB->GetServerVariable(lpECB->ConnID, "ALL_HTTP", static_variable_buf, &variable_len)) { variable_buf = static_variable_buf; } else { -- 2.50.1