[xiph-commits] r18804 - icecast/trunk/icecast/src

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Sat Feb 23 16:53:09 PST 2013


Author: ph3-der-loewe
Date: 2013-02-23 16:53:09 -0800 (Sat, 23 Feb 2013)
New Revision: 18804

Modified:
   icecast/trunk/icecast/src/yp.c
Log:
handle yp headers case insensetive, close #1873

Modified: icecast/trunk/icecast/src/yp.c
===================================================================
--- icecast/trunk/icecast/src/yp.c	2013-02-24 00:42:56 UTC (rev 18803)
+++ icecast/trunk/icecast/src/yp.c	2013-02-24 00:53:09 UTC (rev 18804)
@@ -109,33 +109,34 @@
     unsigned bytes = size * nmemb;
 
     /* DEBUG2 ("header from YP is \"%.*s\"", bytes, ptr); */
-    if (strncmp (ptr, "YPResponse: 1", 13) == 0)
+    if (strncasecmp (ptr, "YPResponse: 1", 13) == 0)
         yp->cmd_ok = 1;
 
-    if (strncmp (ptr, "YPMessage: ", 11) == 0)
+    if (strncasecmp (ptr, "YPMessage: ", 11) == 0)
     {
         unsigned len = bytes - 11;
         free (yp->error_msg);
         yp->error_msg = calloc (1, len);
         if (yp->error_msg)
-            sscanf (ptr, "YPMessage: %[^\r\n]", yp->error_msg);
+            sscanf (ptr + 11, "%[^\r\n]", yp->error_msg);
     }
 
     if (yp->process == do_yp_add)
     {
-        if (strncmp (ptr, "SID: ", 5) == 0)
+        if (strncasecmp (ptr, "SID: ", 5) == 0)
         {
             unsigned len = bytes - 5;
             free (yp->sid);
             yp->sid = calloc (1, len);
             if (yp->sid)
-                sscanf (ptr, "SID: %[^\r\n]", yp->sid);
+                sscanf (ptr + 5, "%[^\r\n]", yp->sid);
         }
     }
-    if (strncmp (ptr, "TouchFreq: ", 11) == 0)
+    if (strncasecmp (ptr, "TouchFreq: ", 11) == 0)
     {
         unsigned secs;
-        sscanf (ptr, "TouchFreq: %u", &secs);
+        if ( sscanf (ptr + 11, "%u", &secs) != 1 )
+            secs = 0;
         if (secs < 30)
             secs = 30;
         DEBUG1 ("server touch interval is %u", secs);



More information about the commits mailing list