Bug #15038 Updated: replace parameter of Header() function doesn't work in Apache module
| From: | edink@php.net | Date: | Sat, 13 Jul 2002 20:46:08 +0000 |
| Subject: | Bug #15038 Updated: replace parameter of Header() function doesn't work in Apache module | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-14088@lists.php.net to get a copy of this message | ||
ID: 15038
Updated by: edink@php.net
Reported By: phpman@toowards.com
-Status: Open
+Status: Feedback
Bug Type: Apache related
Operating System: linux
PHP Version: 4.1.0
New Comment:
There were some recent changes to this code. Could you please try
http://snaps.php.net/php4-latest.tar.gz
Previous Comments:
------------------------------------------------------------------------
[2002-01-15 00:46:03] phpman@toowards.com
The code (from the Header() manual page)
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate");
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// HTTP/1.0
only outputs a single "Cache-control" - the second one.
It seems to me that the "replace" flag of sapi_header was never being
checked.
I've written a fix for this though as shown below. I hope this is
right, and that it is useful to someone :-)
diff -aur php-4.1.0/sapi/apache/mod_php4.c
php-4.1.0-tt/sapi/apache/mod_php4.c
--- php-4.1.0/sapi/apache/mod_php4.c Mon Sep 17 01:49:55 2001
+++ php-4.1.0-tt/sapi/apache/mod_php4.c Tue Jan 15 16:15:28 2002
@@ -206,8 +206,10 @@
r->content_type = pstrdup(r->pool, header_content);
} else if (!strcasecmp(header_name, "Set-Cookie")) {
table_add(r->headers_out, header_name,
header_content);
- } else {
+ } else if ( sapi_header->replace ) {
table_set(r->headers_out, header_name,
header_content);
+ } else {
+ table_add(r->headers_out, header_name,
header_content);
}
*p = ':'; /* a well behaved header handler shouldn't change
its original arguments */
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15038&edit=1