summaryrefslogtreecommitdiff
path: root/sapi/apache2handler/sapi_apache2.c
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2008-12-03 20:30:45 +0000
committerSVN Migration <svn@php.net>2008-12-03 20:30:45 +0000
commit2876046398950e59c3b3c460e67e6fec7ff2ba3c (patch)
tree33b2b8b4b859960a6446ad19d0ada1c55f9cfcda /sapi/apache2handler/sapi_apache2.c
parent3fb86b0b9e79e6a3312b694f30ee627e2e1b325c (diff)
downloadphp-git-php-5.3.0alpha2.tar.gz
This commit was manufactured by cvs2svn to create tag 'php_5_3_0alpha2'.php-5.3.0alpha2
Diffstat (limited to 'sapi/apache2handler/sapi_apache2.c')
-rw-r--r--sapi/apache2handler/sapi_apache2.c61
1 files changed, 23 insertions, 38 deletions
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