Don't let header fields clobber eachother

See: http://php.net/manual/en/function.header.php

2nd option, $replace, should be false if sending multiple headers with the same name.

The difference can be observed by editing index.php (the example index page) so that before `echo 'hello'` is a line: `flight::response()->cache(false);`
and editing Response.php so that before `exit($this->body)` is a line: `var_dump(headers_list());`

Before change:

`array (size=3)`
`0 => string 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' (length=38)`
`1 => string 'Cache-Control: max-age=0' (length=24)`
`2 => string 'Pragma: no-cache' (length=16)`

After:

`array (size=5)`
`0 => string 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' (length=38)`
`1 => string 'Cache-Control: no-store, no-cache, must-revalidate' (length=50)`
`2 => string 'Cache-Control: post-check=0, pre-check=0' (length=40)`
`3 => string 'Cache-Control: max-age=0' (length=24)`
`4 => string 'Pragma: no-cache' (length=16)`
pull/27/head
kafene 12 years ago
parent 293a1e88ed
commit 69e5dab546

@ -181,7 +181,7 @@ class Response {
foreach ($this->headers as $field => $value) { foreach ($this->headers as $field => $value) {
if (is_array($value)) { if (is_array($value)) {
foreach ($value as $v) { foreach ($value as $v) {
header($field.': '.$v); header($field.': '.$v, false);
} }
} }
else { else {

Loading…
Cancel
Save