summaryrefslogtreecommitdiff
path: root/sapi/apache2filter
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2002-10-22 12:20:12 +0000
committerIlia Alshanetsky <iliaa@php.net>2002-10-22 12:20:12 +0000
commitf7b15b0611617a0f5d47c5bf35531a7c8c14b595 (patch)
tree952f22ea221b87d972aa17c5115dadfa20bab176 /sapi/apache2filter
parent5f070780bf31550dcb86b7cf8ad6b7482815be10 (diff)
downloadphp-git-f7b15b0611617a0f5d47c5bf35531a7c8c14b595.tar.gz
Added support for 'engine Off' directive
Added support for 'none' option for *_value options.
Diffstat (limited to 'sapi/apache2filter')
-rw-r--r--sapi/apache2filter/apache_config.c29
-rw-r--r--sapi/apache2filter/php_apache.h1
-rw-r--r--sapi/apache2filter/sapi_apache2.c6
3 files changed, 25 insertions, 11 deletions
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c
index 96b27ddbf2..7433db7224 100644
--- a/sapi/apache2filter/apache_config.c
+++ b/sapi/apache2filter/apache_config.c
@@ -53,23 +53,18 @@ static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name,
{
php_conf_rec *d = dummy;
php_dir_entry e;
- php_dir_entry *pe;
- size_t str_len;
phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy, zend_hash_num_elements(&d->config)));
+
+ if (!strncasecmp(value, "none", sizeof("none"))) {
+ value = "";
+ }
+
e.value = apr_pstrdup(cmd->pool, value);
e.value_len = strlen(value);
e.status = status;
- str_len = strlen(name);
-
- if (zend_hash_find(&d->config, (char *) name, str_len + 1, (void **) &pe) == SUCCESS) {
- if (pe->status > status)
- return NULL;
- }
-
- zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e),
- NULL);
+ zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e), NULL);
return NULL;
}
@@ -141,6 +136,18 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
return new_conf;
}
+char *get_php_config(void *conf, char *name, size_t name_len)
+{
+ php_conf_rec *d = conf;
+ php_dir_entry *pe;
+
+ if (zend_hash_find(&d->config, name, name_len, (void **) &pe) == SUCCESS) {
+ return pe->value;
+ }
+
+ return "";
+}
+
void apply_config(void *dummy)
{
php_conf_rec *d = dummy;
diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h
index 0fde7c515e..0c1399c679 100644
--- a/sapi/apache2filter/php_apache.h
+++ b/sapi/apache2filter/php_apache.h
@@ -48,6 +48,7 @@ typedef struct php_struct {
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
void *create_php_config(apr_pool_t *p, char *dummy);
+char *get_php_config(void *conf, char *name, size_t name_len);
void apply_config(void *);
extern const command_rec php_dir_cmds[];
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
index ab5770eea9..45f13c6ff0 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -390,11 +390,17 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
php_struct *ctx;
apr_bucket *b;
void *conf = ap_get_module_config(f->r->per_dir_config, &php4_module);
+ char *p = get_php_config(conf, "engine", sizeof("engine"));
TSRMLS_FETCH();
if (f->r->proxyreq) {
return ap_pass_brigade(f->next, bb);
}
+
+ /* handle situations where user turns the engine off */
+ if (*p == '0') {
+ return ap_pass_brigade(f->next, bb);
+ }
/* setup standard CGI variables */
ap_add_common_vars(f->r);