summaryrefslogtreecommitdiff
path: root/sapi/apache2filter/sapi_apache2.c
diff options
context:
space:
mode:
authorArnaud Le Blanc <lbarnaud@php.net>2008-11-13 13:41:08 +0000
committerArnaud Le Blanc <lbarnaud@php.net>2008-11-13 13:41:08 +0000
commitaaaf67e19e2b74bc3257d0ddbb3320cec01b15f7 (patch)
tree36f471710515f23305f82643b454f0a689e9a624 /sapi/apache2filter/sapi_apache2.c
parent494dbdb1c187a3c2d77c7f1577ab66d2ec21d224 (diff)
downloadphp-git-aaaf67e19e2b74bc3257d0ddbb3320cec01b15f7.tar.gz
Updated header_handler in apache2filter and apache_hooks
Diffstat (limited to 'sapi/apache2filter/sapi_apache2.c')
-rw-r--r--sapi/apache2filter/sapi_apache2.c61
1 files changed, 38 insertions, 23 deletions
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
index 1edc0f9ea3..ecd1eb624d 100644
--- a/sapi/apache2filter/sapi_apache2.c
+++ b/sapi/apache2filter/sapi_apache2.c
@@ -91,7 +91,7 @@ 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_headers_struct *sapi_headers TSRMLS_DC)
+php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC)
{
php_struct *ctx;
ap_filter_t *f;
@@ -100,29 +100,44 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_str
ctx = SG(server_context);
f = ctx->r->output_filters;
- val = strchr(sapi_header->header, ':');
-
- if (!val) {
- sapi_free_header(sapi_header);
- return 0;
+ switch(op) {
+ case SAPI_HEADER_DELETE:
+ apr_table_unset(ctx->r->headers_out, sapi_header->header);
+ return 0;
+
+ 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) {
+ sapi_free_header(sapi_header);
+ return 0;
+ }
+ ptr = val;
+
+ *val = '\0';
+
+ do {
+ val++;
+ } while (*val == ' ');
+
+ if (!strcasecmp(sapi_header->header, "content-type"))
+ ctx->r->content_type = apr_pstrdup(ctx->r->pool, 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);
+
+ *ptr = ':';
+ return SAPI_HEADER_ADD;
+
+ default:
+ return 0;
}
- ptr = val;
-
- *val = '\0';
-
- do {
- val++;
- } while (*val == ' ');
-
- if (!strcasecmp(sapi_header->header, "content-type"))
- ctx->r->content_type = apr_pstrdup(ctx->r->pool, 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