summaryrefslogtreecommitdiff
path: root/sapi/apache2handler
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/apache2handler')
-rw-r--r--sapi/apache2handler/apache_config.c28
-rw-r--r--sapi/apache2handler/php_functions.c9
-rw-r--r--sapi/apache2handler/sapi_apache2.c61
3 files changed, 36 insertions, 62 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index b53a0c984d..c629dbf48e 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -117,23 +117,6 @@ static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const ch
return NULL;
}
-static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_dir_entry *new_per_dir_entry, zend_hash_key *hash_key, void *pData)
-{
- php_dir_entry *orig_per_dir_entry;
-
- if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &orig_per_dir_entry)==FAILURE) {
- return 1; /* does not exist in dest, copy from source */
- }
-
- if (new_per_dir_entry->status >= orig_per_dir_entry->status) {
- /* use new entry */
- phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", hash_key->arKey, new_per_dir_entry->status, orig_per_dir_entry->status));
- return 1;
- } else {
- return 0;
- }
-}
-
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
{
@@ -145,12 +128,9 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
ulong num_index;
n = create_php_config(p, "merge_php_config");
- /* copy old config */
- zend_hash_copy(&n->config, &d->config, NULL, NULL, sizeof(php_dir_entry));
- /* merge new config */
+ zend_hash_copy(&n->config, &e->config, NULL, NULL, sizeof(php_dir_entry));
+
phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n));
- zend_hash_merge_ex(&n->config, &e->config, NULL, sizeof(php_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
-#if STAS_0
for (zend_hash_internal_pointer_reset(&d->config);
zend_hash_get_current_key_ex(&d->config, &str, &str_len,
&num_index, 0, NULL) == HASH_KEY_IS_STRING;
@@ -160,10 +140,10 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
if (zend_hash_find(&n->config, str, str_len, (void **) &pe) == SUCCESS) {
if (pe->status >= data->status) continue;
}
- phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
zend_hash_update(&n->config, str, str_len, data, sizeof(*data), NULL);
+ phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
}
-#endif
+
return n;
}
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 5fe67a2254..809cf0a69a 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -469,39 +469,48 @@ PHP_MINFO_FUNCTION(apache)
}
/* {{{ arginfo */
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_lookup_uri, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_virtual, 0, 0, 1)
ZEND_ARG_INFO(0, uri)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_response_headers, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_getallheaders, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_note, 0, 0, 1)
ZEND_ARG_INFO(0, note_name)
ZEND_ARG_INFO(0, note_value)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_setenv, 0, 0, 2)
ZEND_ARG_INFO(0, variable)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, walk_to_top)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_getenv, 0, 0, 1)
ZEND_ARG_INFO(0, variable)
ZEND_ARG_INFO(0, walk_to_top)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_version, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_modules, 0)
ZEND_END_ARG_INFO()
/* }}} */
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index cf2e1427be..b8671c59d4 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -83,55 +83,40 @@ php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
}
static int
-php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC)
+php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_struct *sapi_headers TSRMLS_DC)
{
php_struct *ctx;
char *val, *ptr;
ctx = SG(server_context);
- switch (op) {
- case SAPI_HEADER_DELETE:
- apr_table_unset(ctx->r->headers_out, sapi_header->header);
- return 0;
+ val = strchr(sapi_header->header, ':');
- case SAPI_HEADER_DELETE_ALL:
- apr_table_clear(ctx->r->headers_out);
- return 0;
-
- case SAPI_HEADER_ADD:
- case SAPI_HEADER_REPLACE:
- val = strchr(sapi_header->header, ':');
-
- if (!val) {
- return 0;
- }
- ptr = val;
+ if (!val) {
+ sapi_free_header(sapi_header);
+ return 0;
+ }
+ ptr = val;
- *val = '\0';
+ *val = '\0';
- do {
- val++;
- } while (*val == ' ');
-
- if (!strcasecmp(sapi_header->header, "content-type")) {
- if (ctx->content_type) {
- efree(ctx->content_type);
- }
- ctx->content_type = estrdup(val);
- } else if (op == SAPI_HEADER_REPLACE) {
- apr_table_set(ctx->r->headers_out, sapi_header->header, val);
- } else {
- apr_table_add(ctx->r->headers_out, sapi_header->header, val);
- }
+ do {
+ val++;
+ } while (*val == ' ');
- *ptr = ':';
-
- return SAPI_HEADER_ADD;
-
- default:
- return 0;
+ if (!strcasecmp(sapi_header->header, "content-type")) {
+ if (ctx->content_type) {
+ efree(ctx->content_type);
+ }
+ ctx->content_type = estrdup(val);
+ } else if (sapi_header->replace) {
+ apr_table_set(ctx->r->headers_out, sapi_header->header, val);
+ } else {
+ apr_table_add(ctx->r->headers_out, sapi_header->header, val);
}
+ *ptr = ':';
+
+ return SAPI_HEADER_ADD;
}
static int