[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-06-01 Thread Uwe Schindler
thetaphiSat May 31 11:32:38 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  zend_alter_ini_entry now with PHP_INI_USER
  
Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.12 php4/sapi/nsapi/nsapi.c:1.28.2.13
--- php4/sapi/nsapi/nsapi.c:1.28.2.12   Fri May 30 19:39:04 2003
+++ php4/sapi/nsapi/nsapi.c Sat May 31 11:32:38 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: nsapi.c,v 1.28.2.12 2003/05/30 23:39:04 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.28.2.13 2003/05/31 15:32:38 thetaphi Exp $ */
 
 /*
  * PHP includes
@@ -697,7 +697,7 @@
/* change the ini entry */
if (zend_alter_ini_entry(entry-param-name, 
strlen(entry-param-name)+1,
 entry-param-value, strlen(entry-param-value),
-PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME)==FAILURE) {
+PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) {
log_error(LOG_WARN, php4_execute, NSG(sn), 
NSG(rq), Cannot change php.ini key \%s\ to \%s\, entry-param-name, 
entry-param-value);
}
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-05-31 Thread Uwe Schindler
thetaphiFri May 30 09:15:04 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  virtual() now works under windows, too
  
Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.10 php4/sapi/nsapi/nsapi.c:1.28.2.11
--- php4/sapi/nsapi/nsapi.c:1.28.2.10   Thu May 29 17:05:06 2003
+++ php4/sapi/nsapi/nsapi.c Fri May 30 09:15:04 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: nsapi.c,v 1.28.2.10 2003/05/29 21:05:06 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.28.2.11 2003/05/30 13:15:04 thetaphi Exp $ */
 
 /*
  * PHP includes
@@ -211,10 +211,11 @@
 /* newer servers hide this functions from the programmer so redefine the functions 
dynamically
thanks to Chris Elving from Sun for the function declarations */
 
-int (*nsapi_servact_uri2path)(Session *sn, Request *rq) = NULL;
-int (*nsapi_servact_pathchecks)(Session *sn, Request *rq) = NULL;
-int (*nsapi_servact_fileinfo)(Session *sn, Request *rq) = NULL;
-int (*nsapi_servact_service)(Session *sn, Request *rq) = NULL;
+typedef int (*nsapi_servact_prototype)(Session *sn, Request *rq);
+nsapi_servact_prototype nsapi_servact_uri2path = NULL;
+nsapi_servact_prototype nsapi_servact_pathchecks = NULL;
+nsapi_servact_prototype nsapi_servact_fileinfo = NULL;
+nsapi_servact_prototype nsapi_servact_service = NULL;
 
 /* {{{ php_nsapi_init_dynamic_symbols
  */
@@ -226,12 +227,28 @@
nsapi_servact_pathchecks = servact_pathchecks;
nsapi_servact_fileinfo = servact_fileinfo;
nsapi_servact_service = servact_service;
-#elif !defined(PHP_WIN32)
+#else
/* find address of internal NSAPI functions */
-   *(void **)(nsapi_servact_uri2path) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_uri2path);
-   *(void **)(nsapi_servact_pathchecks) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_pathchecks);
-   *(void **)(nsapi_servact_fileinfo) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_fileinfo);
-   *(void **)(nsapi_servact_service) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_service);
+#ifdef PHP_WIN32
+   register int i;
+   char module_name[11];
+   DL_HANDLE module = NULL;
+   /* find a LOADED dll module named ns-httpdX0, where X is version
+* currently there are server-dlls in version 2, 3 and 4 in use */
+   for (i=4; i=2; i--) {
+   sprintf(module_name, ns-httpd%d0, i);
+   if (module = GetModuleHandle(module_name)) {
+   break;
+   }
+   }
+   if (!module) return;
+#else
+   DL_HANDLE module = RTLD_DEFAULT;
+#endif
+   nsapi_servact_uri2path = (nsapi_servact_prototype)DL_FETCH_SYMBOL(module, 
INTservact_uri2path);
+   nsapi_servact_pathchecks = (nsapi_servact_prototype)DL_FETCH_SYMBOL(module, 
INTservact_pathchecks);
+   nsapi_servact_fileinfo = (nsapi_servact_prototype)DL_FETCH_SYMBOL(module, 
INTservact_fileinfo);
+   nsapi_servact_service = (nsapi_servact_prototype)DL_FETCH_SYMBOL(module, 
INTservact_service);
if (!(nsapi_servact_uri2path  nsapi_servact_pathchecks  
nsapi_servact_fileinfo  nsapi_servact_service)) {
/* not found - could be cause they are undocumented */
nsapi_servact_uri2path = NULL;
@@ -787,9 +804,9 @@
 
nsapi_free(SG(request_info).query_string);
nsapi_free(SG(request_info).request_uri);
-   nsapi_free(SG(request_info).request_method);
+   nsapi_free((void*)(SG(request_info).request_method));
nsapi_free(SG(request_info).path_translated);
-   nsapi_free(SG(request_info).content_type);
+   nsapi_free((void*)(SG(request_info).content_type));
 
FREE(request_context);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-05-31 Thread Uwe Schindler
thetaphiFri May 30 19:39:04 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  Disable virtual() if zlib.output_compression is turned on. Better detection of 
ns-httpdXX.dll
  
Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.11 php4/sapi/nsapi/nsapi.c:1.28.2.12
--- php4/sapi/nsapi/nsapi.c:1.28.2.11   Fri May 30 09:15:04 2003
+++ php4/sapi/nsapi/nsapi.c Fri May 30 19:39:04 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: nsapi.c,v 1.28.2.11 2003/05/30 13:15:04 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.28.2.12 2003/05/30 23:39:04 thetaphi Exp $ */
 
 /*
  * PHP includes
@@ -210,13 +210,20 @@
 
 /* newer servers hide this functions from the programmer so redefine the functions 
dynamically
thanks to Chris Elving from Sun for the function declarations */
-
 typedef int (*nsapi_servact_prototype)(Session *sn, Request *rq);
 nsapi_servact_prototype nsapi_servact_uri2path = NULL;
 nsapi_servact_prototype nsapi_servact_pathchecks = NULL;
 nsapi_servact_prototype nsapi_servact_fileinfo = NULL;
 nsapi_servact_prototype nsapi_servact_service = NULL;
 
+#ifdef PHP_WIN32
+/* The following dll-names for nsapi are in use at this time. The undocumented
+ * servact_* functions are always in the newest one, older ones are supported by
+ * the server only by wrapping the function table nothing else. So choose
+ * the newest one found in process space for dynamic linking */
+char *nsapi_dlls[] = { ns-httpd40.dll, ns-httpd36.dll, ns-httpd35.dll, 
ns-httpd30.dll, NULL };
+#endif
+
 /* {{{ php_nsapi_init_dynamic_symbols
  */
 static void php_nsapi_init_dynamic_symbols(void)
@@ -231,13 +238,10 @@
/* find address of internal NSAPI functions */
 #ifdef PHP_WIN32
register int i;
-   char module_name[11];
DL_HANDLE module = NULL;
-   /* find a LOADED dll module named ns-httpdX0, where X is version
-* currently there are server-dlls in version 2, 3 and 4 in use */
-   for (i=4; i=2; i--) {
-   sprintf(module_name, ns-httpd%d0, i);
-   if (module = GetModuleHandle(module_name)) {
+   /* find a LOADED dll module from nsapi_dlls */
+   for (i=0; nsapi_dlls[i]; i++) {
+   if (module = GetModuleHandle(nsapi_dlls[i])) {
break;
}
}
@@ -295,7 +299,8 @@
php_info_print_table_start();
php_info_print_table_row(2, NSAPI support, enabled);
php_info_print_table_row(2, Server Software, system_version());
-   php_info_print_table_row(2, Sub-requests with virtual(), 
(nsapi_servact_service)?enabled:not supported on this platform );
+   php_info_print_table_row(2, Sub-requests with virtual(),
+(nsapi_servact_service)?((zend_ini_long(zlib.output_compression, 
sizeof(zlib.output_compression), 0))?not supported with 
zlib.output_compression:enabled):not supported on this platform );
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
@@ -324,6 +329,9 @@
 
if (!nsapi_servact_service) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to include uri 
'%s' - Sub-requests not supported on this platform, (*uri)-value.str.val);
+   RETURN_FALSE;
+   } else if (zend_ini_long(zlib.output_compression, 
sizeof(zlib.output_compression), 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to include uri 
'%s' - Sub-requests do not work with zlib.output_compression, (*uri)-value.str.val);
RETURN_FALSE;
} else {
php_end_ob_buffers(1 TSRMLS_CC);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-05-30 Thread Uwe Schindler
thetaphiThu May 29 16:13:15 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  Changes for compilation on windows
  
Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.8 php4/sapi/nsapi/nsapi.c:1.28.2.9
--- php4/sapi/nsapi/nsapi.c:1.28.2.8Thu May 29 08:27:39 2003
+++ php4/sapi/nsapi/nsapi.c Thu May 29 16:13:15 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: nsapi.c,v 1.28.2.8 2003/05/29 12:27:39 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.28.2.9 2003/05/29 20:13:15 thetaphi Exp $ */
 
 /*
  * PHP includes
@@ -211,10 +211,10 @@
 /* newer servers hide this functions from the programmer so redefine the functions 
dynamically
thanks to Chris Elving from Sun for the function declarations */
 
-int (NSAPI_PUBLIC *nsapi_servact_uri2path)(Session *, Request *) = NULL;
-int (NSAPI_PUBLIC *nsapi_servact_pathchecks)(Session *, Request *) = NULL;
-int (NSAPI_PUBLIC *nsapi_servact_fileinfo)(Session *, Request *) = NULL;
-int (NSAPI_PUBLIC *nsapi_servact_service)(Session *, Request *) = NULL;
+int (*nsapi_servact_uri2path)(Session *, Request *) = NULL;
+int (*nsapi_servact_pathchecks)(Session *, Request *) = NULL;
+int (*nsapi_servact_fileinfo)(Session *, Request *) = NULL;
+int (*nsapi_servact_service)(Session *, Request *) = NULL;
 
 /* {{{ php_nsapi_init_dynamic_symbols
  */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-05-30 Thread Uwe Schindler
thetaphiThu May 29 17:05:06 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  fix of incomplete windows fix
  
Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.9 php4/sapi/nsapi/nsapi.c:1.28.2.10
--- php4/sapi/nsapi/nsapi.c:1.28.2.9Thu May 29 16:13:15 2003
+++ php4/sapi/nsapi/nsapi.c Thu May 29 17:05:06 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: nsapi.c,v 1.28.2.9 2003/05/29 20:13:15 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.28.2.10 2003/05/29 21:05:06 thetaphi Exp $ */
 
 /*
  * PHP includes
@@ -211,10 +211,10 @@
 /* newer servers hide this functions from the programmer so redefine the functions 
dynamically
thanks to Chris Elving from Sun for the function declarations */
 
-int (*nsapi_servact_uri2path)(Session *, Request *) = NULL;
-int (*nsapi_servact_pathchecks)(Session *, Request *) = NULL;
-int (*nsapi_servact_fileinfo)(Session *, Request *) = NULL;
-int (*nsapi_servact_service)(Session *, Request *) = NULL;
+int (*nsapi_servact_uri2path)(Session *sn, Request *rq) = NULL;
+int (*nsapi_servact_pathchecks)(Session *sn, Request *rq) = NULL;
+int (*nsapi_servact_fileinfo)(Session *sn, Request *rq) = NULL;
+int (*nsapi_servact_service)(Session *sn, Request *rq) = NULL;
 
 /* {{{ php_nsapi_init_dynamic_symbols
  */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-05-29 Thread Uwe Schindler
thetaphiThu May 29 08:27:39 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  MFH: php.ini values in magnus/obj.conf; virtual() similar to apache;...
  Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.7 php4/sapi/nsapi/nsapi.c:1.28.2.8
--- php4/sapi/nsapi/nsapi.c:1.28.2.7Wed May 21 05:34:15 2003
+++ php4/sapi/nsapi/nsapi.c Thu May 29 08:27:39 2003
@@ -17,13 +17,17 @@
+--+
 */
 
-/* $Id: nsapi.c,v 1.28.2.7 2003/05/21 09:34:15 zeev Exp $ */
+/* $Id: nsapi.c,v 1.28.2.8 2003/05/29 12:27:39 thetaphi Exp $ */
 
 /*
  * PHP includes
  */
 #define NSAPI 1
 
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
 #include php.h
 #include php_variables.h
 #include ext/standard/info.h
@@ -34,6 +38,12 @@
 #include php_version.h
 #include TSRM.h
 #include ext/standard/php_standard.h
+#include sys/types.h
+#include sys/stat.h
+
+#ifndef RTLD_DEFAULT
+#define RTLD_DEFAULT NULL
+#endif
 
 /*
  * If neither XP_UNIX not XP_WIN32 is defined use PHP_WIN32
@@ -57,11 +67,6 @@
 #include base/util.h   /* is_mozilla, getline */
 #include frame/log.h   /* log_error */
 
-/*
- * Timeout for net_read(). This should probably go into php.ini
- */
-#define NSAPI_READ_TIMEOUT 60  /* 60 seconds */
-
 #define NSLS_D struct nsapi_request_context *request_context
 #define NSLS_DC, NSLS_D
 #define NSLS_C request_context
@@ -144,6 +149,221 @@
}
 }
 
+
+/***/
+/* PHP module part */
+/***/
+
+PHP_MINIT_FUNCTION(nsapi);
+PHP_MSHUTDOWN_FUNCTION(nsapi);
+PHP_RINIT_FUNCTION(nsapi);
+PHP_RSHUTDOWN_FUNCTION(nsapi);
+PHP_MINFO_FUNCTION(nsapi);
+
+PHP_FUNCTION(virtual);
+
+ZEND_BEGIN_MODULE_GLOBALS(nsapi)
+   long read_timeout;
+ZEND_END_MODULE_GLOBALS(nsapi)
+
+ZEND_DECLARE_MODULE_GLOBALS(nsapi)
+
+#define NSAPI_G(v) TSRMG(nsapi_globals_id, zend_nsapi_globals *, v)
+
+/* compatibility with PHP4_3 */
+#if !defined(OnUpdateLong)
+#define OnUpdateLong OnUpdateInt
+#endif
+
+/* {{{ nsapi_functions[]
+ *
+ * Every user visible function must have an entry in nsapi_functions[].
+ */
+function_entry nsapi_functions[] = {
+   PHP_FE(virtual, NULL)   /* Make subrequest */
+   {NULL, NULL, NULL}  /* Must be the last line in nsapi_functions[] */
+};
+/* }}} */
+
+/* {{{ nsapi_module_entry
+ */
+zend_module_entry nsapi_module_entry = {
+   STANDARD_MODULE_HEADER,
+   nsapi,
+   nsapi_functions,
+   PHP_MINIT(nsapi),
+   PHP_MSHUTDOWN(nsapi),
+   NULL,
+   NULL,
+   PHP_MINFO(nsapi),
+   NO_VERSION_YET,
+   STANDARD_MODULE_PROPERTIES
+};
+/* }}} */
+
+/* {{{ PHP_INI
+ */
+PHP_INI_BEGIN()
+STD_PHP_INI_ENTRY(nsapi.read_timeout, 60, PHP_INI_ALL, OnUpdateLong, 
read_timeout, zend_nsapi_globals, nsapi_globals)
+PHP_INI_END()
+/* }}} */
+
+/* newer servers hide this functions from the programmer so redefine the functions 
dynamically
+   thanks to Chris Elving from Sun for the function declarations */
+
+int (NSAPI_PUBLIC *nsapi_servact_uri2path)(Session *, Request *) = NULL;
+int (NSAPI_PUBLIC *nsapi_servact_pathchecks)(Session *, Request *) = NULL;
+int (NSAPI_PUBLIC *nsapi_servact_fileinfo)(Session *, Request *) = NULL;
+int (NSAPI_PUBLIC *nsapi_servact_service)(Session *, Request *) = NULL;
+
+/* {{{ php_nsapi_init_dynamic_symbols
+ */
+static void php_nsapi_init_dynamic_symbols(void)
+{
+#if defined(servact_uri2path)  defined(servact_pathchecks)  
defined(servact_fileinfo)  defined(servact_service)
+   /* use functions from nsapi.h if available */
+   nsapi_servact_uri2path = servact_uri2path;
+   nsapi_servact_pathchecks = servact_pathchecks;
+   nsapi_servact_fileinfo = servact_fileinfo;
+   nsapi_servact_service = servact_service;
+#elif !defined(PHP_WIN32)
+   /* find address of internal NSAPI functions */
+   *(void **)(nsapi_servact_uri2path) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_uri2path);
+   *(void **)(nsapi_servact_pathchecks) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_pathchecks);
+   *(void **)(nsapi_servact_fileinfo) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_fileinfo);
+   *(void **)(nsapi_servact_service) = DL_FETCH_SYMBOL(RTLD_DEFAULT, 
INTservact_service);
+   if (!(nsapi_servact_uri2path  nsapi_servact_pathchecks  
nsapi_servact_fileinfo  nsapi_servact_service)) {
+   /* not found - could be cause they are undocumented */
+   nsapi_servact_uri2path = NULL;
+   nsapi_servact_pathchecks = NULL;
+   nsapi_servact_fileinfo = NULL;
+   nsapi_servact_service = NULL;
+   }
+#endif
+}
+/* }}} */
+
+/* {{{ php_nsapi_init_globals
+ */
+static void php_nsapi_init_globals(zend_nsapi_globals *nsapi_globals)
+{
+   nsapi_globals-read_timeout = 60;
+}
+/* }}} */
+
+/* {{{ PHP_MINIT_FUNCTION
+ */
+PHP_MINIT_FUNCTION(nsapi)
+{
+  

[PHP-CVS] cvs: php4(PHP_4_3) /sapi/nsapi nsapi.c

2003-02-09 Thread Jani Taskinen
sniper  Sun Feb  9 18:27:50 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/sapi/nsapinsapi.c 
  Log:
  MFH: Fixed _SERVER[] variables, memleaks
  
Index: php4/sapi/nsapi/nsapi.c
diff -u php4/sapi/nsapi/nsapi.c:1.28.2.1 php4/sapi/nsapi/nsapi.c:1.28.2.2
--- php4/sapi/nsapi/nsapi.c:1.28.2.1Tue Dec 31 11:27:13 2002
+++ php4/sapi/nsapi/nsapi.c Sun Feb  9 18:27:50 2003
@@ -13,6 +13,7 @@
| [EMAIL PROTECTED] so we can mail you a copy immediately.   |
+--+
| Author: Jayakumar Muthukumarasamy [EMAIL PROTECTED]   |
+   | Uwe Schindler [EMAIL PROTECTED]  |
+--+
 */
 
@@ -66,6 +67,8 @@
 #define NSLS_CC, NSLS_C
 #define NSG(v) (request_context-v)
 
+#define NS_BUF_SIZE 2048
+
 /*
  * ZTS needs to be defined for NSAPI to work
  */
@@ -95,17 +98,7 @@
 
 static nsapi_equiv nsapi_headers[] = {
{ CONTENT_LENGTH, content-length },
-   { CONTENT_TYPE,   content-type },
-   { HTTP_ACCEPT,accept },
-   { HTTP_ACCEPT_ENCODING,   accept-encoding },
-   { HTTP_ACCEPT_LANGUAGE,   accept-language },
-   { HTTP_ACCEPT_CHARSET,accept-charset },
-   { HTTP_AUTHORIZATION, authorization },
-   { HTTP_COOKIE,cookie },
-   { HTTP_IF_MODIFIED_SINCE, if-modified-since },
-   { HTTP_REFERER,   referer },
-   { HTTP_USER_AGENT,user-agent },
-   { HTTP_USER_DEFINED,  user-defined }
+   { CONTENT_TYPE,   content-type }
 };
 static size_t nsapi_headers_size = sizeof(nsapi_headers)/sizeof(nsapi_headers[0]);
 
@@ -113,14 +106,14 @@
{ QUERY_STRING,   query },
{ REQUEST_LINE,   clf-request },
{ REQUEST_METHOD, method },
-   { SCRIPT_NAME,uri },
+   { PHP_SELF,   uri },
{ SERVER_PROTOCOL,protocol }
 };
 static size_t nsapi_reqpb_size = sizeof(nsapi_reqpb)/sizeof(nsapi_reqpb[0]);
 
 static nsapi_equiv nsapi_vars[] = {
{ PATH_INFO,  path-info },
-   { PATH_TRANSLATED,path },
+   { SCRIPT_FILENAME,path },
{ AUTH_TYPE,  auth-type },
{ CLIENT_CERT,auth-cert },
{ REMOTE_USER,auth-user }
@@ -130,10 +123,26 @@
 static nsapi_equiv nsapi_client[] = {
{ HTTPS_KEYSIZE,  keysize },
{ HTTPS_SECRETSIZE,   secret-keysize },
-   { REMOTE_ADDR,ip }
+   { REMOTE_ADDR,ip },
+   { REMOTE_HOST,ip }
 };
 static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]);
 
+static char *
+nsapi_strdup(char *str)
+{
+   if (str != NULL)
+   return STRDUP(str);
+   return NULL;
+}
+
+static void
+nsapi_free(void *addr)
+{
+   if (addr != NULL)
+   FREE(addr);
+}
+
 static int
 sapi_nsapi_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
 {
@@ -280,9 +289,10 @@
 sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_DC)
 {
nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-   size_t i;
-   char *value;
-   char buf[128];
+   register size_t i;
+   char *value,*p;
+   char buf[NS_BUF_SIZE + 1];
+   struct pb_entry *entry;
 
for (i = 0; i  nsapi_reqpb_size; i++) {
value = pblock_findval(nsapi_reqpb[i].nsapi_eq, rc-rq-reqpb);
@@ -290,7 +300,7 @@
php_register_variable( (char *)nsapi_reqpb[i].env_var, value, 
track_vars_array TSRMLS_CC );
}
}
-   
+
for (i = 0; i  nsapi_headers_size; i++) {
value = pblock_findval(nsapi_headers[i].nsapi_eq, rc-rq-headers);
if (value) {
@@ -298,6 +308,21 @@
}
}
 
+   for (i=0; i  rc-rq-headers-hsize; i++) {
+   entry=rc-rq-headers-ht[i];
+   while (entry) {
+   snprintf(buf,NS_BUF_SIZE,HTTP_%s,entry-param-name);
+   for(p = buf + 5; *p; p++) {
+   *p = toupper(*p);
+   if(*p  'A' || *p  'Z') {
+   *p = '_';
+   }
+   }
+   php_register_variable( buf, entry-param-value, 
+track_vars_array TSRMLS_CC );
+   entry=entry-next;
+   }
+   }
+
for (i = 0; i  nsapi_vars_size; i++) {
value = pblock_findval(nsapi_vars[i].nsapi_eq, rc-rq-vars);
if (value) {
@@ -311,35 +336,69 @@