[xiph-commits] r18735 - branches/dir.xiph.org/cronjobs

dm8tbr at svn.xiph.org dm8tbr at svn.xiph.org
Sat Dec 8 07:53:45 PST 2012


Author: dm8tbr
Date: 2012-12-08 07:53:45 -0800 (Sat, 08 Dec 2012)
New Revision: 18735

Modified:
   branches/dir.xiph.org/cronjobs/check_servers.php
Log:
Added special handling for radionomy hosts.
We are to forced to trust those blindly as they can't figure out their IDS and constantly fail checks and destabilize listings.



Modified: branches/dir.xiph.org/cronjobs/check_servers.php
===================================================================
--- branches/dir.xiph.org/cronjobs/check_servers.php	2012-12-07 20:37:02 UTC (rev 18734)
+++ branches/dir.xiph.org/cronjobs/check_servers.php	2012-12-08 15:53:45 UTC (rev 18735)
@@ -20,7 +20,7 @@
 // Old stuff that "timeouted"
 try
 {
-    $res = $db->selectQuery('SELECT `id`, `listen_url` FROM `server` WHERE `checked` = 0;');
+    $res = $db->selectQuery('SELECT `id`, `listen_url` FROM `server` WHERE `checked` = 0');
     while (!$res->endOf())
     {
         try
@@ -41,54 +41,63 @@
             {
                 throw new ToDeleteException();
             }
-            
-            // Try to open a connection to the server
-            $ok = false;
-            $count = 0;
-            while ($count < 3 && !$ok)
+
+            // Check if this is a radionomy host.
+            // If yes, trust it blindly as they can't figure out their IDS and constantly fail checks and destabilize listings.
+            if (preg_match('/^streaming20.\.radionomy.com$/', $url['host']))
             {
-                $fp = @fsockopen($url['host'],
-                                 array_key_exists('port', $url) ? $url['port'] : 80, // as per HTTP RFC
-                                 $errno, $errstr, 3);
-                if (!$fp)
+                $ok = true;
+            }
+            else
+            {
+                // Try to open a connection to the server
+                $ok = false;
+                $count = 0;
+                while ($count < 3 && !$ok)
                 {
-                    $count++;
-                    continue;
-                }
+                    $fp = @fsockopen($url['host'],
+                                     array_key_exists('port', $url) ? $url['port'] : 80, // as per HTTP RFC
+                                     $errno, $errstr, 3);
+                    if (!$fp)
+                    {
+                        $count++;
+                        continue;
+                    }
                 
-                // Now send a request
-                $req = sprintf("GET %s HTTP/1.0\r\n\r\n", $url['path']);
-                $r = fwrite($fp, $req);
-                if (!$r || $r != strlen($req))
-                {
-                    fclose($fp);
-                    $count++;
-                    continue;
-                }
-                $r = 0;
-                $headers = array();
-                do
-                {
-                    $data = fgets($fp);
-                    if (trim($data) != '')
+                    // Now send a request
+                    $req = sprintf("GET %s HTTP/1.0\r\n\r\n", $url['path']);
+                    $r = fwrite($fp, $req);
+                    if (!$r || $r != strlen($req))
                     {
-                        list($header, $value) = explode(':', $data);
-                        $headers[strtolower(trim($header))] = trim($value);
+                        fclose($fp);
+                        $count++;
+                        continue;
                     }
-                    $r++;
-                }
-                while (trim($data) != '' && $r < 10);
+                    $r = 0;
+                    $headers = array();
+                    do
+                    {
+                        $data = fgets($fp);
+                        if (trim($data) != '')
+                        {
+                            list($header, $value) = explode(':', $data);
+                            $headers[strtolower(trim($header))] = trim($value);
+                        }
+                        $r++;
+                    }
+                    while (trim($data) != '' && $r < 10);
                 
-                // Extremely dangerous, disabled.
-/*              if (!array_key_exists('server', $headers)
-                    || !stristr($headers['server'], 'icecast'))
-                {
-                    throw new ToDeleteException();
-                }*/
-                fclose($fp);
+                    // Extremely dangerous, disabled.
+/*                  if (!array_key_exists('server', $headers)
+                        || !stristr($headers['server'], 'icecast'))
+                    {
+                        throw new ToDeleteException();
+                    }*/
+                    fclose($fp);
                 
-                $count++;
-                $ok = true;
+                    $count++;
+                    $ok = true;
+                }
             }
             if (!$ok)
             {



More information about the commits mailing list