IPv6 support #2
[stouyapi.git] / www / api / v1 / queued_downloads.php
index dd52bcd05622f2b586fe01cd38101c62a44e9189..6edeaad2534a7f2d6e020c65f1ac126d985d6b9d 100644 (file)
@@ -12,8 +12,9 @@ $apiGameDir = __DIR__ . '/details-data/';
 require_once __DIR__ . '/../../../src/push-to-my-ouya-helpers.php';
 
 $ip = $_SERVER['REMOTE_ADDR'];
-if ($ip == '' || strpos($ip, ':') !== false) {
-    //empty or IPv6
+if ($ip == '') {
+    //empty ip
+    header('X-Fail-Reason: empty ip address');
     header('Content-type: application/json');
     echo file_get_contents('queued_downloads');
     exit(1);
@@ -24,6 +25,7 @@ try {
     $db = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
 } catch (Exception $e) {
     //db file not found
+    header('X-Fail-Reason: database file not found');
     header('Content-type: application/json');
     echo file_get_contents('queued_downloads');
     exit(1);