aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-07-07 02:10:11 +0000
committerrvelices <rv-github@modusoptimus.com>2007-07-07 02:10:11 +0000
commitc9465002447bd13fcd18f952d3530435c938c764 (patch)
tree61c042cbc33d462287d981d473a2cb80903f4c60
parent1463bf22952dcd83f4209756a4a409d1b5d3e8be (diff)
merge r2052 from branch-1_7 to trunk
- fix set_status_header for fastCGI installations that are strict in terms of http protocol (1.0 or 1.1) git-svn-id: http://piwigo.org/svn/trunk@2053 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_html.inc.php16
-rw-r--r--include/ws_core.inc.php3
2 files changed, 15 insertions, 4 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index af74d0f69..e62adc65d 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -704,10 +704,22 @@ function set_status_header($code, $text='')
case 401: $text='Authorization required';break;
case 403: $text='Forbidden';break;
case 404: $text='Not found';break;
+ case 500: $text='Server error';break;
+ case 503: $text='Service unavailable';break;
}
}
- header("HTTP/1.1 $code $text");
- header("Status: $code $text");
+ $protocol = $_SERVER["SERVER_PROTOCOL"];
+ if ( ('HTTP/1.1' != $protocol) && ('HTTP/1.0' != $protocol) )
+ $protocol = 'HTTP/1.0';
+
+ if ( version_compare( phpversion(), '4.3.0', '>=' ) )
+ {
+ header( "$protocol $code $text", true, $code );
+ }
+ else
+ {
+ header( "$protocol $code $text" );
+ }
trigger_action('set_status_header', $code, $text);
}
diff --git a/include/ws_core.inc.php b/include/ws_core.inc.php
index 915e7e147..bc8d7f468 100644
--- a/include/ws_core.inc.php
+++ b/include/ws_core.inc.php
@@ -380,8 +380,7 @@ class PwgServer
{
if ( is_null($this->_responseEncoder) )
{
- @header("HTTP/1.1 500 Server error");
- @header("Status: 500 Server error");
+ set_status_header(500);
@header("Content-Type: text/plain");
echo ("Cannot process your request. Unknown response format.
Request format: ".@$this->_requestFormat." handler:".$this->_requestHandler."