#15038 [Opn->Fbk]: replace parameter of Header() function doesn't work in Apache module
| From: | sniper@php.net | Date: | Thu, 22 Aug 2002 21:20:11 +0000 |
| Subject: | #15038 [Opn->Fbk]: 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-17598@lists.php.net to get a copy of this message | ||
ID: 15038
Updated by: sniper@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:
Which version is it? Please update this report to have the correct
version number.
Previous Comments:
------------------------------------------------------------------------
[2002-08-22 01:27:27] phpman@toowards.com
This problem has returned using the current cvs
------------------------------------------------------------------------
[2002-07-20 02:21:36] phpman@toowards.com
latest cvs fixes this problem
see bug #16458
------------------------------------------------------------------------
[2002-07-13 16:46:08] edink@php.net
There were some recent changes to this code. Could you please try
http://snaps.php.net/php4-latest.tar.gz
------------------------------------------------------------------------
[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