mike Sun May 28 20:32:00 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/sapi/apache2handler php_apache.h sapi_apache2.c
Log:
MFH: call ap_set_content_type() only once, else each time we call it,
configured output filters for that content type will be added
http://cvs.php.net/viewcvs.cgi/php-src/sapi/apache2handler/php_apache.h?r1=1.8.2.1&r2=1.8.2.1.2.1&diff_format=u
Index: php-src/sapi/apache2handler/php_apache.h
diff -u php-src/sapi/apache2handler/php_apache.h:1.8.2.1
php-src/sapi/apache2handler/php_apache.h:1.8.2.1.2.1
--- php-src/sapi/apache2handler/php_apache.h:1.8.2.1 Sun Jan 1 12:50:18 2006
+++ php-src/sapi/apache2handler/php_apache.h Sun May 28 20:32:00 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_apache.h,v 1.8.2.1 2006/01/01 12:50:18 sniper Exp $ */
+/* $Id: php_apache.h,v 1.8.2.1.2.1 2006/05/28 20:32:00 mike Exp $ */
#ifndef PHP_APACHE_H
#define PHP_APACHE_H
@@ -44,6 +44,8 @@
#endif
/* Whether or not we've processed PHP in the output filters yet. */
int request_processed;
+ /* final content type */
+ char *content_type;
} php_struct;
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
http://cvs.php.net/viewcvs.cgi/php-src/sapi/apache2handler/sapi_apache2.c?r1=1.57.2.10&r2=1.57.2.10.2.1&diff_format=u
Index: php-src/sapi/apache2handler/sapi_apache2.c
diff -u php-src/sapi/apache2handler/sapi_apache2.c:1.57.2.10
php-src/sapi/apache2handler/sapi_apache2.c:1.57.2.10.2.1
--- php-src/sapi/apache2handler/sapi_apache2.c:1.57.2.10 Sun Mar 19
14:54:53 2006
+++ php-src/sapi/apache2handler/sapi_apache2.c Sun May 28 20:32:00 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sapi_apache2.c,v 1.57.2.10 2006/03/19 14:54:53 mike Exp $ */
+/* $Id: sapi_apache2.c,v 1.57.2.10.2.1 2006/05/28 20:32:00 mike Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -105,8 +105,10 @@
} while (*val == ' ');
if (!strcasecmp(sapi_header->header, "content-type")) {
- val = apr_pstrdup(ctx->r->pool, val);
- ap_set_content_type(ctx->r, val);
+ 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 {
@@ -131,6 +133,15 @@
&& sline[8] == ' ') {
ctx->r->status_line = apr_pstrdup(ctx->r->pool, sline + 9);
}
+
+ /* call ap_set_content_type only once, else each time we call it,
+ configured output filters for that content type will be added */
+ if (!ctx->content_type) {
+ ctx->content_type = sapi_get_default_content_type(TSRMLS_C);
+ }
+ ap_set_content_type(ctx->r, apr_pstrdup(ctx->r->pool,
ctx->content_type));
+ efree(ctx->content_type);
+ ctx->content_type = NULL;
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
@@ -418,10 +429,6 @@
SG(request_info).path_translated = apr_pstrdup(r->pool, r->filename);
r->no_local_copy = 1;
- content_type = sapi_get_default_content_type(TSRMLS_C);
- ap_set_content_type(r, apr_pstrdup(r->pool, content_type));
- efree(content_type);
-
content_length = (char *) apr_table_get(r->headers_in,
"Content-Length");
SG(request_info).content_length = (content_length ?
atoi(content_length) : 0);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php