mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Status header fix (fcgi + cgi.rfc2616_headers = 1)
This commit is contained in:
parent
0db3c77f77
commit
5f450e680f
1 changed files with 18 additions and 16 deletions
|
|
@ -530,23 +530,25 @@ class Http
|
||||||
*/
|
*/
|
||||||
public function StatusHeader($iStatus, $sCustomStatusText = '')
|
public function StatusHeader($iStatus, $sCustomStatusText = '')
|
||||||
{
|
{
|
||||||
switch ($iStatus)
|
$iStatus = (int) $iStatus;
|
||||||
|
if (99 < $iStatus)
|
||||||
{
|
{
|
||||||
default:
|
$aStatus = array(
|
||||||
\header('Status: '.$iStatus, true, $iStatus);
|
301 => 'Moved Permanently',
|
||||||
break;
|
304 => 'Not Modified',
|
||||||
case 304:
|
200 => 'OK',
|
||||||
\header($this->ServerProtocol().' 304 '.(0 === \strlen($sCustomStatusText) ? 'Not Modified' : $sCustomStatusText), true, $iStatus);
|
400 => 'Bad Request',
|
||||||
break;
|
401 => 'Unauthorized',
|
||||||
case 200:
|
403 => 'Forbidden',
|
||||||
\header($this->ServerProtocol().' 200 '.(0 === \strlen($sCustomStatusText) ? 'OK' : $sCustomStatusText), true, $iStatus);
|
404 => 'Not Found',
|
||||||
break;
|
405 => 'Method Not Allowed'
|
||||||
case 401:
|
);
|
||||||
\header($this->ServerProtocol().' 401 '.(0 === \strlen($sCustomStatusText) ? 'Please sign in' : $sCustomStatusText), true, $iStatus);
|
|
||||||
break;
|
$sCustomStatusText = \trim($sCustomStatusText);
|
||||||
case 404:
|
$sHeaderHead = \ini_get('cgi.rfc2616_headers') && false !== \strpos(\strtolower(\php_sapi_name()), 'cgi') ? 'Status:' : $this->ServerProtocol();
|
||||||
\header($this->ServerProtocol().' 404 '.(0 === \strlen($sCustomStatusText) ? 'Not Found' : $sCustomStatusText), true, $iStatus);
|
$sHeaderText = (0 === \strlen($sCustomStatusText) && isset($aStatus[$iStatus]) ? $aStatus[$iStatus] : $sCustomStatusText);
|
||||||
break;
|
|
||||||
|
\header(\trim($sHeaderHead.' '.$iStatus.' '.$sHeaderText), true, $iStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue