Changes of Revision 5
[-] | Added | php5-txforward.changes |
1
2 +------------------------------------------------------------------- 3 +Fri May 6 20:12:11 UTC 2011 - cs@linux-administrator.com 4 + 5 +- update to release 1.0.7 6 + 7 |
||
[-] | Changed | php5-txforward.spec ^ |
18 1
2 # norootforbuild 3 %define pkg_name txforward 4 -%define pkg_version 1.0.6 5 +%define pkg_version 1.0.7 6 %define php_version %(php-config --version 2>/dev/null) 7 # 8 Name: php5-txforward 9
10 Requires: php5 = %{php_version} 11 # 12 URL: http://pecl.php.net/ 13 -Source: http://pecl.php.net/package/%{pkg_name}/%{pkg_name}-%{version}.tgz 14 +Source: http://pecl.php.net/package/%{pkg_name}/%{pkg_name}-%{version}.tar.bz2 15 Summary: Reverse Proxy (web accelerator) PHP compatibility layer 16 17 %description 18 |
||
Deleted | TXForward-1.0.3.tgz ^ | |
[+] | Deleted | txforward-1.0.5.tgz/txforward-1.0.5/README ^ |
@@ -1,15 +0,0 @@ -TXForward (Tranparent X-Forwarding) module -==================== -What is it for ? -Enabling this module allows you to use reverse proxies (web accelerators, especially Squid) with any PHP script. -You don't need anymore X-Forwarded aware scripts: Just scripts that works only with REMOTE_ADDR. -==================== -How does it works ? -It extracts the real remote address from the X-Forwarded header and substitutes it to the endpoint IP address. -The real IP (proxy's one) is still available through $_SERVER['REAL_REMOTE_ADDR'] -==================== -WARNINGS: --Enabling this module if you're not behing a reverse proxy allows people to fake their IP ! --Currently only works with 1 level proxying (no chained accelerators) - -Todo: Multiple level proxying, proxy IP range checks | ||
[+] | Deleted | txforward-1.0.5.tgz/txforward-1.0.5/php_txforward.h ^ |
@@ -1,61 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2008 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Francois Cartegnie <pecldev@free.fr> | - +----------------------------------------------------------------------+ -*/ - -/* $Id: php_txforward.h,v 1.2 2008/11/30 23:17:44 txforward Exp $ */ - -#ifndef PHP_TXFORWARD_H -#define PHP_TXFORWARD_H - -extern zend_module_entry txforward_module_entry; -#define phpext_txforward_ptr &txforward_module_entry - -#ifdef PHP_WIN32 -#define PHP_TXFORWARD_API __declspec(dllexport) -#else -#define PHP_TXFORWARD_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -PHP_RINIT_FUNCTION(txforward); -PHP_MINFO_FUNCTION(txforward); - -#define TXFORWARDING_NAME "Transparent X-Forwarding" -#define TXFORWARDING_EXTNAME "txforward" -#define TXFORWARDING_VERSION "1.05" -#define TXFORWARDING_WARNING "This module must only be used with trusted reverse proxies, and without proxy chain propagation." - -#ifdef ZTS -#define TXFORWARD_G(v) TSRMG(txforward_globals_id, zend_txforward_globals *, v) -#else -#define TXFORWARD_G(v) (txforward_globals.v) -#endif - -#endif /* PHP_TXFORWARD_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ | ||
[+] | Deleted | txforward-1.0.5.tgz/txforward-1.0.5/txforward.c ^ |
@@ -1,157 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2008 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Francois Cartegnie <pecldev@free.fr> | - +----------------------------------------------------------------------+ -*/ - -/* $Id: txforward.c,v 1.2 2008/10/18 15:28:15 txforward Exp $ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_txforward.h" - -/* If you declare any globals in php_txforward.h uncomment this: -ZEND_DECLARE_MODULE_GLOBALS(txforward) -*/ - -/* True global resources - no need for thread safety here */ -static int le_txforward; - -/* {{{ txforward_functions[] - * - * Every user visible function must have an entry in txforward_functions[]. - */ -zend_function_entry txforward_functions[] = { - {NULL, NULL, NULL} /* Must be the last line in txforward_functions[] */ -}; -/* }}} */ - -/* {{{ txforward_module_entry - */ -zend_module_entry txforward_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 - STANDARD_MODULE_HEADER, -#endif - TXFORWARDING_EXTNAME, - NULL, - NULL, - NULL, - PHP_RINIT(txforward), - NULL, - PHP_MINFO(txforward), -#if ZEND_MODULE_API_NO >= 20010901 - TXFORWARDING_VERSION, -#endif - STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_TXFORWARD -ZEND_GET_MODULE(txforward) -#endif - -PHP_MINFO_FUNCTION(txforward) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "Transparent X-Forwarding Support", "enabled"); - php_info_print_table_row(2, "Version", TXFORWARDING_VERSION); - php_info_print_table_row(2, "Security", TXFORWARDING_WARNING); - php_info_print_table_row(2, "Real IP stored in", "$_SERVER['REAL_REMOTE_ADDR']"); - php_info_print_table_end(); -} - -PHP_RINIT_FUNCTION(txforward) -{ - zval **serverhash = NULL; - zval **remote_addr = NULL; - zval *real_remote_addr = NULL; - zval **forwarded_for = NULL; - zval **pass = NULL; - zval *newval = NULL; - HashTable *htable; - char *periodpointer = NULL; - char *newstring = NULL; - int oldstringsize=0; - char *oldpointer = NULL; - -#ifdef ZEND_ENGINE_2_1 - zend_is_auto_global("_SERVER", sizeof("_SERVER") - 1 TSRMLS_CC); -#endif - if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &serverhash) != SUCCESS || Z_TYPE_PP(serverhash) != IS_ARRAY) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "_SERVER is corrupted"); - zend_bailout(); - } - htable = HASH_OF((*serverhash)); - - if (zend_hash_find(htable, "HTTP_X_FORWARDED_FOR", sizeof("HTTP_X_FORWARDED_FOR"), (void **) &forwarded_for) == FAILURE) { - forwarded_for = NULL; - } else - if (zend_hash_find(htable, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr) == FAILURE) { - remote_addr = NULL; - } else - if (Z_TYPE_PP(forwarded_for) != IS_STRING || Z_TYPE_PP(remote_addr) != IS_STRING) { - forwarded_for = NULL; - remote_addr = NULL; - } else { - /* create a new PHP variable. */ - MAKE_STD_ZVAL(real_remote_addr); - *real_remote_addr = **remote_addr; /* copy content */ - zval_copy_ctor(real_remote_addr); - zend_hash_add(htable, "REAL_REMOTE_ADDR", sizeof("REAL_REMOTE_ADDR"), &real_remote_addr, sizeof(zval*), NULL); - - - periodpointer = strrchr((**forwarded_for).value.str.val, ','); - oldstringsize = (**forwarded_for).value.str.len; - oldpointer = (**forwarded_for).value.str.val; - - if ( periodpointer != NULL ) - { /* The remote address itself is behind a proxy. X-Forwarded:IP1, IP2, IP3.. keep only the trusted one*/ - /* let's fake string length, so only our wanted bytes will be copied and allocated by zval_copy_ctor in our new zend variable */ - periodpointer = periodpointer + 1; /* space after period */ - (**forwarded_for).value.str.len = ((**forwarded_for).value.str.val + (**forwarded_for).value.str.len) - periodpointer - 1; /* fake length */ - (**forwarded_for).value.str.val = periodpointer + 1; - } - - MAKE_STD_ZVAL(newval); - *newval = **forwarded_for; - - zval_copy_ctor(*forwarded_for); /*more efficient copy*/ - - (**forwarded_for).value.str.len = oldstringsize; /* restore length in case we changed it before copy */ - (**forwarded_for).value.str.val = oldpointer; /* restore original string pointer */ - - zend_hash_del(htable, "REMOTE_ADDR", sizeof("REMOTE_ADDR")); - - zend_hash_update(htable, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), &newval, sizeof(zval*), NULL); - - } - - return SUCCESS; -} - - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ | ||
Deleted | txforward-1.0.6.tgz ^ | |
[+] | Changed | txforward-1.0.7.tar.bz2/package.xml ^ |
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.7.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>txforward</name> <channel>pecl.php.net</channel> <summary>Reverse Proxy (web accelerator) PHP compatibility layer</summary> @@ -15,26 +15,28 @@ <email>pecldev@free.fr</email> <active>yes</active> </lead> - <date>2008-12-01</date> - <time>00:18:12</time> + <date>2011-05-04</date> + <time>20:48:28</time> <version> - <release>1.0.5</release> - <api>1.0.5</api> + <release>1.0.7</release> + <api>1.0.7</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> <license uri="http://www.php.net/license">PHP License</license> - <notes>pecl channel fix</notes> + <notes> +pecl channel fix + </notes> <contents> <dir name="/" role="src"> <file md5sum="cf48e1988cbf6325d05e5576eddb827f" name="CREDITS" role="doc" /> - <file md5sum="a831b954d0c8d60336194c52cbeb5303" name="README" role="doc" /> + <file md5sum="3575058e1f13ea95390ac516376a4f83" name="README" role="doc" /> <file md5sum="5fc319430510c02a231432e36d0f9d1c" name="config.m4" role="src" /> <file md5sum="ea8d5b2f6be07e2aa35dc10c618718d2" name="config.w32" role="src" /> - <file md5sum="a921b85cac0abc818d3d5886573da2b4" name="php_txforward.h" role="src" /> - <file md5sum="2f11d2aaa02d7344bbfd2758c42fdf38" name="txforward.c" role="src" /> + <file md5sum="9571cfeb97c96cfcf47aba46a36198f3" name="php_txforward.h" role="src" /> + <file md5sum="d621388c5dac37f3ffedb3355bbbfbb3" name="txforward.c" role="src" /> </dir> </contents> <dependencies> | ||
[+] | Changed | txforward-1.0.7.tar.bz2/txforward-1.0.7/CREDITS ^ |
(renamed from txforward-1.0.5/CREDITS) | ||
[+] | Changed | txforward-1.0.7.tar.bz2/txforward-1.0.7/CREDITS ^ |
(renamed from txforward-1.0.5/CREDITS) | ||
[+] | Added | txforward-1.0.7.tar.bz2/txforward-1.0.7/README ^ |
@@ -0,0 +1,26 @@ +TXForward (Tranparent X-Forwarding) module +==================== +What is it for ? +Enabling this module allows you to use reverse proxies (web accelerators, especially Squid) with any PHP script. +You don't need anymore X-Forwarded aware scripts: Just scripts that works only with REMOTE_ADDR. +==================== +How does it works ? +It extracts the real remote address from the X-Forwarded header and substitutes it to the endpoint IP address. +The real IP (proxy's one) is still available through $_SERVER['REAL_REMOTE_ADDR'] +==================== +WARNING: +-Enabling this module if you're not behing a reverse proxy allows people to fake their IP ! + +If you're chaining proxies, you can specify proxy depth in your php.ini. +For exemple for 3 chained proxies: + + CLIENTS <-> RPROXY1 <-> RPROXY2 <-> RPROXY3 <-> WEBSERVER +depth 4 3 2 1 0 + +You can specify: + [txforward] + txforward.depth = 4 +This will look for the IP that is in position 4 behind the 3 chained proxies. + +In case of misconfiguration, it always falls back to a depth of 0. + | ||
[+] | Changed | txforward-1.0.7.tar.bz2/txforward-1.0.7/config.m4 ^ |
(renamed from txforward-1.0.5/config.m4) | ||
[+] | Changed | txforward-1.0.7.tar.bz2/txforward-1.0.7/config.m4 ^ |
(renamed from txforward-1.0.5/config.m4) | ||
[+] | Changed | txforward-1.0.7.tar.bz2/txforward-1.0.7/config.w32 ^ |
(renamed from txforward-1.0.5/config.w32) | ||
[+] | Changed | txforward-1.0.7.tar.bz2/txforward-1.0.7/config.w32 ^ |
(renamed from txforward-1.0.5/config.w32) | ||
[+] | Added | txforward-1.0.7.tar.bz2/txforward-1.0.7/php_txforward.h ^ |
@@ -0,0 +1,56 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2008 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Francois Cartegnie <pecldev@free.fr> | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_TXFORWARD_H +#define PHP_TXFORWARD_H + +extern zend_module_entry txforward_module_entry; +#define phpext_txforward_ptr &txforward_module_entry + +#ifdef PHP_WIN32 +#define PHP_TXFORWARD_API __declspec(dllexport) +#else +#define PHP_TXFORWARD_API +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +PHP_MINIT_FUNCTION(txforward); +PHP_MSHUTDOWN_FUNCTION(txforward); +PHP_RINIT_FUNCTION(txforward); +PHP_MINFO_FUNCTION(txforward); + +ZEND_BEGIN_MODULE_GLOBALS(txforward) + int proxy_depth; /* configuration directive */ +ZEND_END_MODULE_GLOBALS(txforward) + +#define TXFORWARDING_NAME "Transparent X-Forwarding" +#define TXFORWARDING_EXTNAME "txforward" +#define TXFORWARDING_VERSION "1.07" +#define TXFORWARDING_WARNING "This module must only be used with trusted reverse proxies, and without proxy chain propagation." + +#ifdef ZTS +#define TXFORWARD_G(v) TSRMG(txforward_globals_id, zend_txforward_globals *, v) +#else +#define TXFORWARD_G(v) (txforward_globals.v) +#endif + +#endif /* PHP_TXFORWARD_H */ + | ||
[+] | Added | txforward-1.0.7.tar.bz2/txforward-1.0.7/txforward.c ^ |
@@ -0,0 +1,191 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2008 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Francois Cartegnie <pecldev@free.fr> | + +----------------------------------------------------------------------+ +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_ini.h" +#include "ext/standard/info.h" +#include "php_txforward.h" + + +ZEND_DECLARE_MODULE_GLOBALS(txforward) + + /* {{{ txforward_module_entry + */ + zend_module_entry txforward_module_entry = { +#if ZEND_MODULE_API_NO >= 20010901 + STANDARD_MODULE_HEADER, +#endif + TXFORWARDING_EXTNAME, + NULL, + PHP_MINIT(txforward), + PHP_MSHUTDOWN(txforward), + PHP_RINIT(txforward), + NULL, + PHP_MINFO(txforward), +#if ZEND_MODULE_API_NO >= 20010901 + TXFORWARDING_VERSION, +#endif + STANDARD_MODULE_PROPERTIES + }; + +#ifdef COMPILE_DL_TXFORWARD +ZEND_GET_MODULE(txforward) +#endif + + /* Declare PHP ini configuration entry */ +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("txforward.depth", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, proxy_depth, zend_txforward_globals, txforward_globals) +PHP_INI_END() + +static void php_txforward_init_globals(zend_txforward_globals *txforward_globals) +{ + txforward_globals->proxy_depth = 1; +} + +/* + * Returns the number Nth position from end of c in the string s + */ +char * php_strrchr_n(char * s, int c, int * number) +{ + char * localperiodpointer = NULL; + char * nextperiodpointer = NULL; + localperiodpointer = strchr(s, c); + if (localperiodpointer!=NULL) + { + nextperiodpointer = php_strrchr_n(localperiodpointer + 1, c, number); + *number = *number - 1; /* Give my position from the end */ + } + + if (*number == 0) /* My position is now zero, that what we're looking for */ + return localperiodpointer; + else + return nextperiodpointer; /* Has been/not been found yet */ +} + +PHP_MINFO_FUNCTION(txforward) +{ + php_info_print_table_start(); + php_info_print_table_header(2, "Transparent X-Forwarding Support", "enabled"); + php_info_print_table_row(2, "Version", TXFORWARDING_VERSION); + php_info_print_table_row(2, "Security", TXFORWARDING_WARNING); + php_info_print_table_row(2, "Real IP stored in", "$_SERVER['REAL_REMOTE_ADDR']"); + php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); +} + +PHP_MINIT_FUNCTION(txforward) +{ + ZEND_INIT_MODULE_GLOBALS(txforward, php_txforward_init_globals, NULL); + REGISTER_INI_ENTRIES(); + if (TXFORWARD_G(proxy_depth)<1) TXFORWARD_G(proxy_depth) = 1; /* sanitize */ + return SUCCESS; +} + +PHP_MSHUTDOWN_FUNCTION(txforward) +{ + UNREGISTER_INI_ENTRIES(); + return SUCCESS; +} + +PHP_RINIT_FUNCTION(txforward) +{ + zval **serverhash = NULL; + zval **remote_addr = NULL; + zval *real_remote_addr = NULL; + zval **forwarded_for = NULL; + zval *newval = NULL; + HashTable *htable; + char *periodpointer = NULL; + char *tailpointer = NULL; + char *startpointer = NULL; + int oldstringsize=0; + int currentdepth=1; + char *oldpointer = NULL; + +#ifdef ZEND_ENGINE_2_1 + zend_is_auto_global("_SERVER", sizeof("_SERVER") - 1 TSRMLS_CC); +#endif + if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &serverhash) != SUCCESS || Z_TYPE_PP(serverhash) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "_SERVER is corrupted"); + zend_bailout(); + } + htable = HASH_OF((*serverhash)); + + if (zend_hash_find(htable, "HTTP_X_FORWARDED_FOR", sizeof("HTTP_X_FORWARDED_FOR"), (void **) &forwarded_for) == FAILURE ) { + forwarded_for = NULL; + } else + if (zend_hash_find(htable, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr) == FAILURE) { + remote_addr = NULL; + } else + if (Z_TYPE_PP(forwarded_for) != IS_STRING || Z_TYPE_PP(remote_addr) != IS_STRING) { + forwarded_for = NULL; + remote_addr = NULL; + } else { + /* The remote address itself is behind a proxy. X-Forwarded:IP1, IP2, IP3.. keep only the trusted one*/ + /* create a new PHP variable. */ + MAKE_STD_ZVAL(real_remote_addr); + *real_remote_addr = **remote_addr; /* copy content */ + zval_copy_ctor(real_remote_addr); + zend_hash_add(htable, "REAL_REMOTE_ADDR", sizeof("REAL_REMOTE_ADDR"), &real_remote_addr, sizeof(zval*), NULL); + + oldstringsize = Z_STRLEN_PP(forwarded_for); + oldpointer = Z_STRVAL_PP(forwarded_for); + + if (TXFORWARD_G(proxy_depth) > 1) + { + currentdepth = TXFORWARD_G(proxy_depth); /* not sure if I can modify ini's one without doing it globally */ + periodpointer = php_strrchr_n(Z_STRVAL_PP(forwarded_for), ',', ¤tdepth); /* Find end of IP.*/ + } else { + periodpointer = strrchr(Z_STRVAL_PP(forwarded_for), ','); + } + + if ( (periodpointer != NULL) && (periodpointer > Z_STRVAL_PP(forwarded_for)) ) /* if proxy and valid */ + { + tailpointer = --periodpointer; /* point before period */ + while ( (periodpointer > Z_STRVAL_PP(forwarded_for)) && (*periodpointer != ',') ) periodpointer--; + + if ( ((periodpointer + 2) > tailpointer) || (periodpointer == Z_STRVAL_PP(forwarded_for)) ) + startpointer = Z_STRVAL_PP(forwarded_for); + else + startpointer = periodpointer + 2; /* period + space */ + + /* let's fake string length, so only our wanted bytes will be copied and allocated by zval_copy_ctor in our new zend variable */ + Z_STRLEN_PP(forwarded_for) = tailpointer - startpointer +1 ; /* fake length */ + Z_STRVAL_PP(forwarded_for) = startpointer; + } + MAKE_STD_ZVAL(newval); + *newval = **forwarded_for; + + zval_copy_ctor(*forwarded_for); /*more efficient copy*/ + + Z_STRLEN_PP(forwarded_for) = oldstringsize; /* restore length in case we changed it before copy */ + Z_STRVAL_PP(forwarded_for) = oldpointer; /* restore original string pointer */ + + zend_hash_del(htable, "REMOTE_ADDR", sizeof("REMOTE_ADDR")); + + zend_hash_update(htable, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), &newval, sizeof(zval*), NULL); + + } + + return SUCCESS; +} + |