Index: kernel/error/view.php
===================================================================
--- kernel/error/view.php	(revision 13868)
+++ kernel/error/view.php	(working copy)
@@ -92,18 +92,14 @@
             if ( isset( $errorMap[$errorNumber] ) )
             {
                 $httpErrorCode = $errorMap[$errorNumber];
-                if ( $errorINI->hasVariable( 'HTTPError-' . $httpErrorCode, 'HTTPName' ) )
+                $httpHeader =& eZHTTPHeader::instance();
+                $httpHeader->setStatusCode( $httpErrorCode );
+                if ( $errorNumber == EZ_ERROR_KERNEL_MOVED )
                 {
-                    $httpErrorName = $errorINI->variable( 'HTTPError-' . $httpErrorCode, 'HTTPName' );
-                    $httpErrorString = "$httpErrorCode $httpErrorName";
-                    header( eZSys::serverVariable( 'SERVER_PROTOCOL' ) . " $httpErrorString" );
-                    header( "Status: $httpErrorString" );
-                    if ( $errorNumber == EZ_ERROR_KERNEL_MOVED )
-                    {
-                        $location = eZSys::indexDir() . "/" . $extraErrorParameters['new_location'];
-                        header( "Location: " . $location );
-                    }
+                    $location = eZSys::indexDir() . "/" . $extraErrorParameters['new_location'];
+                    $httpHeader->setAttribute( "Location", $location );
                 }
+                $httpHeader->send();
             }
         }
     }
Index: index.php
===================================================================
--- index.php	(revision 13868)
+++ index.php	(working copy)
@@ -414,16 +414,11 @@
     setlocale( LC_ALL, explode( ',', $phpLocale ) );
 }
 
-// send header information
-header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
-header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
-header( 'Cache-Control: no-cache, must-revalidate' );
-header( 'Pragma: no-cache' );
-header( 'X-Powered-By: eZ publish' );
+include_once( "lib/ezutils/classes/ezhttpheader.php" );
+$httpHeader =& eZHTTPHeader::instance();
+$httpHeader->setStatusCode( 200 );
+$httpHeader->send();
 
-header( 'Content-Type: text/html; charset=' . $httpCharset );
-header( 'Content-language: ' . $languageCode );
-
 include_once( 'kernel/classes/ezsection.php' );
 eZSection::initGlobalID();
 
@@ -889,6 +884,7 @@
         $templateResult =& $tpl->fetch( 'design:redirect.tpl' );
 
         eZDebug::addTimingPoint( "End" );
+        
 
         eZDisplayResult( $templateResult );
     }
Index: settings/error.ini
===================================================================
--- settings/error.ini	(revision 13868)
+++ settings/error.ini	(working copy)
@@ -92,18 +92,3 @@
 RerunURL[]
 EmbedURL[]
 HTTPError[1]=404
-
-# Definition for the HTTP error code 404.
-# It's possible to specify more error codes by creating a group called
-# HTTPError followed by a - (dash) and the HTTP error code.
-# The group most contain the HTTPName variable, if not the error code
-# is not issed to the browser.
-# Note: The HTTPName must be contain the correct string for the
-#       specific HTTP error code.
-[HTTPError-404]
-HTTPName=Not Found
-
-# Definition of the HTTP error code 301
-# URL moved permanently
-[HTTPError-301]
-HTTPName=Moved Permanently
Index: lib/ezutils/classes/ezhttptool.php
===================================================================
--- lib/ezutils/classes/ezhttptool.php	(revision 13868)
+++ lib/ezutils/classes/ezhttptool.php	(working copy)
@@ -491,8 +491,13 @@
     function redirect( $path, $parameters = array() )
     {
         $uri = eZHTTPTool::createRedirectUrl( $path, $parameters );
-        eZHTTPTool::headerVariable( 'Location', $uri );
 
+        include_once( "lib/ezutils/classes/ezhttpheader.php" );
+        $httpHeader =& eZHTTPHeader::instance();
+        $httpHeader->attribue( 'Location', $uri );
+        $httpHeader->setStatusCode( 302 );
+        $httpHeader->send();
+
         /* Fix for redirecting using workflows and apache 2 */
         echo '<HTML><HEAD>';
         echo '<META HTTP-EQUIV="Refresh" Content="0;URL='. htmlspecialchars( $uri ) .'">';
@@ -503,7 +508,8 @@
     /*!
      \static
      Sets the header variable \a $headerName to have the data \a $headerData.
-     \note Calls PHPs header() with a constructed string.
+     \note Calls PHPs header() with a constructed string
+     \note This function is obsolete, please make use of ezhttpheader.
     */
     function headerVariable( $headerName, $headerData )
     {
Index: lib/ezutils/classes/ezhttpheader.php
===================================================================
--- lib/ezutils/classes/ezhttpheader.php	(revision 0)
+++ lib/ezutils/classes/ezhttpheader.php	(revision 0)
@@ -0,0 +1,168 @@
+<?php
+
+define('HTTP_HEADER_STATUS_100', '100 Continue');
+define('HTTP_HEADER_STATUS_101', '101 Switching Protocols');
+define('HTTP_HEADER_STATUS_102', '102 Processing');
+
+define('HTTP_HEADER_STATUS_200', '200 OK');
+define('HTTP_HEADER_STATUS_201', '201 Created');
+define('HTTP_HEADER_STATUS_202', '202 Accepted');
+define('HTTP_HEADER_STATUS_203', '203 Non-Authoritative Information');
+define('HTTP_HEADER_STATUS_204', '204 No Content');
+define('HTTP_HEADER_STATUS_205', '205 Reset Content');
+define('HTTP_HEADER_STATUS_206', '206 Partial Content');
+define('HTTP_HEADER_STATUS_207', '207 Multi-Status');
+
+define('HTTP_HEADER_STATUS_300', '300 Multiple Choices');
+define('HTTP_HEADER_STATUS_301', '301 Moved Permanently');
+define('HTTP_HEADER_STATUS_302', '302 Found');
+define('HTTP_HEADER_STATUS_303', '303 See Other');
+define('HTTP_HEADER_STATUS_304', '304 Not Modified');
+define('HTTP_HEADER_STATUS_305', '305 Use Proxy');
+define('HTTP_HEADER_STATUS_306', '306 (Unused)');
+define('HTTP_HEADER_STATUS_307', '307 Temporary Redirect');
+
+define('HTTP_HEADER_STATUS_400', '400 Bad Request');
+define('HTTP_HEADER_STATUS_401', '401 Unauthorized');
+define('HTTP_HEADER_STATUS_402', '402 Payment Granted');
+define('HTTP_HEADER_STATUS_403', '403 Forbidden');
+define('HTTP_HEADER_STATUS_404', '404 File Not Found');
+define('HTTP_HEADER_STATUS_405', '405 Method Not Allowed');
+define('HTTP_HEADER_STATUS_406', '406 Not Acceptable');
+define('HTTP_HEADER_STATUS_407', '407 Proxy Authentication Required');
+define('HTTP_HEADER_STATUS_408', '408 Request Time-out');
+define('HTTP_HEADER_STATUS_409', '409 Conflict');
+define('HTTP_HEADER_STATUS_410', '410 Gone');
+define('HTTP_HEADER_STATUS_411', '411 Length Required');
+define('HTTP_HEADER_STATUS_412', '412 Precondition Failed');
+define('HTTP_HEADER_STATUS_413', '413 Request Entity Too Large');
+define('HTTP_HEADER_STATUS_414', '414 Request-URI Too Large');
+define('HTTP_HEADER_STATUS_415', '415 Unsupported Media Type');
+define('HTTP_HEADER_STATUS_416', '416 Requested range not satisfiable');
+define('HTTP_HEADER_STATUS_417', '417 Expectation Failed');
+define('HTTP_HEADER_STATUS_422', '422 Unprocessable Entity');
+define('HTTP_HEADER_STATUS_423', '423 Locked');
+define('HTTP_HEADER_STATUS_424', '424 Failed Dependency');
+
+define('HTTP_HEADER_STATUS_500', '500 Internal Server Error');
+define('HTTP_HEADER_STATUS_501', '501 Not Implemented');
+define('HTTP_HEADER_STATUS_502', '502 Bad Gateway');
+define('HTTP_HEADER_STATUS_503', '503 Service Unavailable');
+define('HTTP_HEADER_STATUS_504', '504 Gateway Time-out');
+define('HTTP_HEADER_STATUS_505', '505 HTTP Version not supported');
+define('HTTP_HEADER_STATUS_507', '507 Insufficient Storage');
+
+
+class eZHTTPHeader
+{
+    var $current = array();
+    var $version = "1.1";
+
+    function eZHTTPHeader()
+    {
+        $this->setDefaultHeader();
+    }
+    function setDefaultHeader()
+    {
+        $this->current = array();
+        include_once( 'lib/ezlocale/classes/ezlocale.php' );
+        include_once( 'lib/ezi18n/classes/eztextcodec.php' );
+        $locale =& eZLocale::instance();
+        $languageCode = $locale->httpLocaleCode();
+        $default = array( 
+                      'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
+                      'Date' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
+                      'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
+                      'Cache-Control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
+                      'Pragma' => 'no-cache',
+                      'X-Powered-By' => 'eZ publish',
+                      'Content-Type' => 'text/html; charset=' . eZTextCodec::httpCharset(),
+                      'Content-language' => $languageCode,
+                      'Status-Code' => '200'
+                    );
+        foreach( $default as $name => $value )
+        {
+            $this->setAttribute( $name, $value );
+
+        }
+    }
+    function attribute( $name )
+    {
+        $name = strtolower( $name );
+        if ( array_key_exists( $name, $this->current ) )
+            return $this->current[$name];
+        else
+            return null;
+    }
+    function setAttribute( $name, $value )
+    {
+        $name = strtolower( $name );
+        if ( !$name and !$value )
+            return false;
+        else
+        {
+            $this->current[$name] = strval( $value );
+            return true;
+        }
+    }
+    function isValid()
+    {
+        if ( !is_array( $this->current ) and count( $this->current ) )
+            return false;
+        $contenttype = $this->attribute( 'Content-Type' );
+        if ( empty( $contenttype ) )
+            return false;
+        if ( !defined('HTTP_HEADER_STATUS_'. $this->attribute( 'Status-Code' ) ) )
+            return false;
+            
+        /*
+        TODO:
+
+        HTTP 1.1
+        Section 7.2.2 Length
+        Implement Content-Length
+
+        */
+        return true;
+    }
+    function statusCode( )
+    {
+        return $this->attribute( 'Status-Code' );
+    }
+    function setStatusCode( $code = 200 )
+    {
+        return $this->setAttribute( 'Status-Code', strval( $code ) );
+    }
+    function send()
+    {
+        if ( headers_sent() )
+        {
+            eZDebug::writeError( "HTTP header already send.", "eZHTTPHeader" );
+            return false;        
+        }
+        
+        if ( !$this->isValid() )
+        {
+            eZDebug::writeWarning( "HTTP header not valid.", "eZHTTPHeader" );
+        }
+        if ( defined('HTTP_HEADER_STATUS_'. $this->attribute( 'Status-Code' ) ) )
+        {
+            header( "HTTP/" . $this->version . " " . constant( 'HTTP_HEADER_STATUS_' . $this->attribute( 'Status-Code' ) ) );
+        }
+
+        foreach ( $this->current as $name => $value )
+        {
+            header( $name .":" . $value );
+        }
+    }
+    function &instance()
+    {
+        if ( isset( $GLOBALS['eZHTTPHeaderInstance'] ) )
+    	   return $GLOBALS['eZHTTPHeaderInstance'];
+        $instance = new eZHTTPHeader();
+        $GLOBALS['eZHTTPHeaderInstance'] =& $instance;
+        return $instance;
+    }
+}
+
+?>
\ No newline at end of file

Property changes on: lib\ezutils\classes\ezhttpheader.php
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native

