diff options
author | Rasmus Lerdorf <rasmus@php.net> | 2001-09-22 10:11:53 +0000 |
---|---|---|
committer | Rasmus Lerdorf <rasmus@php.net> | 2001-09-22 10:11:53 +0000 |
commit | 1df380da5aa243c223e1d6c2134aef60811d4f08 (patch) | |
tree | 745f8eab8477744784c2b1e38731fc360de3fa27 /sapi/apache/php_apache.c | |
parent | b46354b7bc79a1d852f7a1b7e61b5bcd510d4a4a (diff) | |
download | php-git-1df380da5aa243c223e1d6c2134aef60811d4f08.tar.gz |
new apache_setenv()
@- add apache_setenv() function for injecting variables into Apache's
@ subprocess_env table.
Diffstat (limited to 'sapi/apache/php_apache.c')
-rw-r--r-- | sapi/apache/php_apache.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index 95d31afe91..8cff77e6c4 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -68,6 +68,7 @@ PHP_FUNCTION(apachelog); PHP_FUNCTION(apache_note); PHP_FUNCTION(apache_lookup_uri); PHP_FUNCTION(apache_child_terminate); +PHP_FUNCTION(apache_setenv); PHP_MINFO_FUNCTION(apache); @@ -77,6 +78,7 @@ function_entry apache_functions[] = { PHP_FE(apache_note, NULL) PHP_FE(apache_lookup_uri, NULL) PHP_FE(apache_child_terminate, NULL) + PHP_FE(apache_setenv, NULL) {NULL, NULL, NULL} }; @@ -357,6 +359,28 @@ PHP_FUNCTION(getallheaders) } /* }}} */ +/* {{{ proto int apache_setenv(string variable, string value [, boolean walk_to_top]) + Set an Apache subprocess_env variable */ +PHP_FUNCTION(apache_setenv) +{ + int var_len, val_len, top=0; + char *var = NULL, *val = NULL; + request_rec *r = (request_rec *) SG(server_context); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &var, &var_len, &val, &val_len, &top) == FAILURE) { + RETURN_FALSE; + } + + while(top) { + if(r->prev) r = r->prev; + else break; + } + + ap_table_setn(r->subprocess_env, ap_pstrndup(r->pool, var, var_len), ap_pstrndup(r->pool, val, val_len)); + RETURN_TRUE; +} +/* }}} */ + /* {{{ proto class apache_lookup_uri(string URI) Perform a partial request of the given URI to obtain information about it */ PHP_FUNCTION(apache_lookup_uri) |