]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check for missing path_info, also use OC_Response for 404 error
authorBart Visscher <bartv@thisnet.nl>
Sat, 9 Jun 2012 12:32:02 +0000 (14:32 +0200)
committerBart Visscher <bartv@thisnet.nl>
Sat, 9 Jun 2012 12:39:41 +0000 (14:39 +0200)
remote.php

index 7131dfc9407faedc3e325abd8f7e38fb1da277d8..b1be50f36a7d4d9382d58f6ef31030be91ff5c2e 100644 (file)
@@ -7,13 +7,17 @@ if (array_key_exists('PATH_INFO', $_SERVER)){
 }else{
        $path_info = substr($_SERVER['PHP_SELF'], strpos($_SERVER['PHP_SELF'], basename(__FILE__)) + strlen(basename(__FILE__)));
 }
+if ($path_info === false) {
+       OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
+       exit;
+}
 if (!$pos = strpos($path_info, '/', 1)) {
        $pos = strlen($path_info);
 }
 $service=substr($path_info, 1, $pos-1);
 $file = OC_AppConfig::getValue('core', 'remote_' . $service);
 if(is_null($file)){
-       header('HTTP/1.0 404 Not Found');
+       OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
        exit;
 }
 
@@ -22,4 +26,4 @@ $app=$parts[2];
 OC_App::loadApp($app);
 
 $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
-require_once(OC::$APPSROOT . $file);
\ No newline at end of file
+require_once(OC::$APPSROOT . $file);