cvs: phpweb /include errors.inc

From: Date: Thu, 17 Jan 2008 19:17:23 +0000
Subject: cvs: phpweb /include errors.inc
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-884@lists.php.net to get a copy of this message
bjori Thu Jan 17 19:17:23 2008 UTC Modified files: /phpweb/include errors.inc Log: Fixed bug#43843 (Documentation sites return HTTP/1.1 even if 1.0 requested -> Garbage in Output) Patch by thekid@ http://cvs.php.net/viewvc.cgi/phpweb/include/errors.inc?r1=1.7&r2=1.8&diff_format=u Index: phpweb/include/errors.inc diff -u phpweb/include/errors.inc:1.7 phpweb/include/errors.inc:1.8 --- phpweb/include/errors.inc:1.7 Thu May 31 17:10:45 2007 +++ phpweb/include/errors.inc Thu Jan 17 19:17:23 2008 @@ -1,5 +1,5 @@ <?php -// $Id: errors.inc,v 1.7 2007/05/31 17:10:45 bjori Exp $ +// $Id: errors.inc,v 1.8 2008/01/17 19:17:23 bjori Exp $ /* This script provides functions to print out @@ -74,9 +74,21 @@ case 404: $status = "Not Found"; break; default: return FALSE; } + + // Figure out HTTP protocol version - use 1.1 answer for 1.1 request, + // answer with HTTP/1.0 for any other (ancient or futuristic) user + switch (strtoupper($_SERVER['SERVER_PROTOCOL'])) { + case 'HTTP/1.0': + @header("HTTP/1.0 $num $status"); + break; + + case 'HTTP/1.1': + default: + @header("HTTP/1.1 $num $status"); + break; + } // BC code for PHP < 4.3.0 - @header("HTTP/1.1 $num $status"); @header("Status: $num $status", TRUE, $num); return TRUE;

« previous php.webmaster (#884) next »