]> granicus.if.org Git - php/commitdiff
Added support for 'engine Off' directive
authorIlia Alshanetsky <iliaa@php.net>
Tue, 22 Oct 2002 12:20:12 +0000 (12:20 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 22 Oct 2002 12:20:12 +0000 (12:20 +0000)
Added support for 'none' option for *_value options.

sapi/apache2filter/apache_config.c
sapi/apache2filter/php_apache.h
sapi/apache2filter/sapi_apache2.c

index 96b27ddbf23812fec29bb0d952d4a0c09539df60..7433db7224532418592f86d81ab7931117399005 100644 (file)
@@ -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;
index 0fde7c515e8251bd9da59f342df0cdbad776103f..0c1399c679a1c3f5df615115c0046b4af035c555 100644 (file)
@@ -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[];
 
index ab5770eea9ce77ad93434b88a54005d60272297f..45f13c6ff0df5c26ac68e5e4abebf7e3d085cb04 100644 (file)
@@ -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);