Parcourir la source

API: put back test getallheaders

https://github.com/marienfressinaud/FreshRSS/issues/443
Alexandre Alapetite il y a 12 ans
Parent
commit
0694739969
1 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 7 1
      p/api/greader.php

+ 7 - 1
p/api/greader.php

@@ -25,7 +25,9 @@ require(LIB_PATH . '/lib_rss.php');	//Includes class autoloader
 
 $ORIGINAL_INPUT = file_get_contents('php://input');
 
-if (!function_exists('getallheaders')) {	//nginx	http://php.net/getallheaders#84262
+$nativeGetallheaders = function_exists('getallheaders');
+
+if (!$nativeGetallheaders) {	//nginx	http://php.net/getallheaders#84262
 	function getallheaders() {
 		$headers = '';
 		foreach ($_SERVER as $name => $value) {
@@ -126,6 +128,10 @@ function checkCompatibility() {
 	if (PHP_INT_SIZE < 8 && !function_exists('gmp_init')) {
 		die('FAIL 64-bit or GMP extension!');
 	}
+	global $nativeGetallheaders;
+	if ((!$nativeGetallheaders) && isset($_SERVER['SERVER_SOFTWARE']) && (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') === false)) {
+		die('FAIL getallheaders! (probably)');
+	}
 	echo 'PASS';
 	exit();
 }