Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Let null header $value indicate HTTP status line

Differentiates the HTTP Status Line from the Header Fields. A blank value
can be sent as $value by specifying an empty string rather than NULL.

    $headers->header( 'HTTP/1.0 404' ); // header( 'HTTP/1.0 404' )
    $headers->header( 'Pragma', '' );   // header( 'Pragma: ' )
  • Loading branch information...
commit 8d80cde7f9554a46ba8edf757db87c13bb17384c 1 parent c7f3968
@abackstrom abackstrom authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 klein.php
View
15 klein.php
@@ -373,7 +373,7 @@ public function chunk($str = null) {
}
//Sets a response header
- public function header($key, $value = '') {
+ public function header($key, $value = null) {
self::$_headers->header($key, $value);
}
@@ -769,11 +769,20 @@ public function __call( $method, $args ) {
}
class _Headers {
- public function header($key, $value = '') {
+ public function header($key, $value = null) {
header($this->_header($key, $value));
}
- public function _header($key, $value = '') {
+ /**
+ * Output an HTTP header. If $value is null, $key is
+ * assume to be the HTTP response code, and the ":"
+ * separator will be omitted.
+ */
+ public function _header($key, $value = null) {
+ if (null === $value ) {
+ return $key;
+ }
+
$key = str_replace(' ', '-', ucwords(str_replace('-', ' ', $key)));
return "$key: $value";
}
Please sign in to comment.
Something went wrong with that request. Please try again.