core: Set code in header() instead of calling http_response_code()
This commit is contained in:
parent
85c34a0960
commit
3031fa406d
3 changed files with 6 additions and 11 deletions
|
@ -426,8 +426,7 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
// Show captcha filling form to the viewer, proxying the captcha image
|
// Show captcha filling form to the viewer, proxying the captcha image
|
||||||
$img = base64_encode(getContents($captcha->find('img', 0)->src));
|
$img = base64_encode(getContents($captcha->find('img', 0)->src));
|
||||||
|
|
||||||
http_response_code(500);
|
header('Content-Type: text/html', true, 500);
|
||||||
header('Content-Type: text/html');
|
|
||||||
|
|
||||||
$message = <<<EOD
|
$message = <<<EOD
|
||||||
<form method="post" action="?{$_SERVER['QUERY_STRING']}">
|
<form method="post" action="?{$_SERVER['QUERY_STRING']}">
|
||||||
|
|
11
index.php
11
index.php
|
@ -240,7 +240,7 @@ try {
|
||||||
$stime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
$stime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||||
|
|
||||||
if($mtime <= $stime) { // Cached data is older or same
|
if($mtime <= $stime) { // Cached data is older or same
|
||||||
header('HTTP/1.1 304 Not Modified');
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s ', $mtime) . 'GMT', true, 304);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,13 +317,11 @@ try {
|
||||||
$format->display();
|
$format->display();
|
||||||
} catch(Error $e) {
|
} catch(Error $e) {
|
||||||
error_log($e);
|
error_log($e);
|
||||||
http_response_code($e->getCode());
|
header('Content-Type: text/html', true, $e->getCode());
|
||||||
header('Content-Type: text/html');
|
|
||||||
die(buildTransformException($e, $bridge));
|
die(buildTransformException($e, $bridge));
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
error_log($e);
|
error_log($e);
|
||||||
http_response_code($e->getCode());
|
header('Content-Type: text/html', true, $e->getCode());
|
||||||
header('Content-Type: text/html');
|
|
||||||
die(buildTransformException($e, $bridge));
|
die(buildTransformException($e, $bridge));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -331,8 +329,7 @@ try {
|
||||||
}
|
}
|
||||||
} catch(HttpException $e) {
|
} catch(HttpException $e) {
|
||||||
error_log($e);
|
error_log($e);
|
||||||
http_response_code($e->getCode());
|
header('Content-Type: text/plain', true, $e->getCode());
|
||||||
header('Content-Type: text/plain');
|
|
||||||
die($e->getMessage());
|
die($e->getMessage());
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
error_log($e);
|
error_log($e);
|
||||||
|
|
|
@ -5,8 +5,7 @@ class Authentication {
|
||||||
|
|
||||||
if(Configuration::getConfig('authentication', 'enable') === true) {
|
if(Configuration::getConfig('authentication', 'enable') === true) {
|
||||||
if(!Authentication::verifyPrompt()) {
|
if(!Authentication::verifyPrompt()) {
|
||||||
header('WWW-Authenticate: Basic realm="RSS-Bridge"');
|
header('WWW-Authenticate: Basic realm="RSS-Bridge"', true, 401);
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
|
||||||
die('Please authenticate in order to access this instance !');
|
die('Please authenticate in order to access this instance !');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue