From d11e80e1b3135ad8396c625057f5db4475148c7c Mon Sep 17 00:00:00 2001 From: ken restivo Date: Fri, 20 Nov 2015 15:17:33 -0800 Subject: [PATCH 1/2] Bump version, migrator needs to depend on it for f164ddf --- version.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.inc b/version.inc index 05ca8c657..625be791e 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-11-20.1222 +2015-11-20.1223 From fabf7081d39481bb22ee27c4beaf96e5529168eb Mon Sep 17 00:00:00 2001 From: ken restivo Date: Fri, 20 Nov 2015 18:56:41 -0800 Subject: [PATCH 2/2] Use http_status() instead of homegrowing it. Adapt http_status to handle replies with data. --- include/network.php | 33 +++++++++++++++++++++++++-------- include/system_unavailable.php | 4 +++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/include/network.php b/include/network.php index 65599bd05..026f5ee0a 100644 --- a/include/network.php +++ b/include/network.php @@ -320,6 +320,29 @@ function xml_status($st, $message = '') { killme(); } + + +/** + * @brief Send HTTP status header + * + * @param int $val + * integer HTTP status result value + * @param string $msg + * optional message + * @returns nil + */ +function http_status($val, $msg = '') { + if ($val >= 400) + $msg = (($msg) ? $msg : 'Error'); + if ($val >= 200 && $val < 300) + $msg = (($msg) ? $msg : 'OK'); + + logger('http_status_exit ' . $val . ' ' . $msg); + header($_SERVER['SERVER_PROTOCOL'] . ' ' . $val . ' ' . $msg); +} + + + /** * @brief Send HTTP status header and exit. * @@ -330,18 +353,12 @@ function xml_status($st, $message = '') { * @returns (does not return, process is terminated) */ function http_status_exit($val, $msg = '') { - - if ($val >= 400) - $msg = (($msg) ? $msg : 'Error'); - if ($val >= 200 && $val < 300) - $msg = (($msg) ? $msg : 'OK'); - - logger('http_status_exit ' . $val . ' ' . $msg); - header($_SERVER['SERVER_PROTOCOL'] . ' ' . $val . ' ' . $msg); + http_status($val, $msg); killme(); } + // convert an XML document to a normalised, case-corrected array // used by webfinger diff --git a/include/system_unavailable.php b/include/system_unavailable.php index 00a73fc38..4e0e6717b 100644 --- a/include/system_unavailable.php +++ b/include/system_unavailable.php @@ -1,7 +1,9 @@ System Unavailable