[xiph-commits] r9545 - icecast/branches/kh/icecast/src

karl at svn.xiph.org karl at svn.xiph.org
Sun Jul 3 07:10:49 PDT 2005


Author: karl
Date: 2005-07-03 07:10:46 -0700 (Sun, 03 Jul 2005)
New Revision: 9545

Modified:
   icecast/branches/kh/icecast/src/client.c
   icecast/branches/kh/icecast/src/connection.c
Log:
make shoutcast source clients work if they send \n, and only log in access
log if there is a response code set


Modified: icecast/branches/kh/icecast/src/client.c
===================================================================
--- icecast/branches/kh/icecast/src/client.c	2005-07-02 16:21:26 UTC (rev 9544)
+++ icecast/branches/kh/icecast/src/client.c	2005-07-03 14:10:46 UTC (rev 9545)
@@ -83,7 +83,7 @@
     /* write log entry if ip is set (some things don't set it, like outgoing 
      * slave requests
      */
-    if (client->con && client->con->ip)
+    if (client->respcode)
         logging_access(client);
 
 #ifdef HAVE_AIO

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-07-02 16:21:26 UTC (rev 9544)
+++ icecast/branches/kh/icecast/src/connection.c	2005-07-03 14:10:46 UTC (rev 9545)
@@ -340,10 +340,21 @@
 
             node->offset += len;
             client->refbuf->data [node->offset] = '\000';
-            if (node->shoutcast == 1 && strstr (client->refbuf->data, "\r\n") != NULL)
-                pass_it = 1;
-            if (strstr (client->refbuf->data, "\r\n\r\n") != NULL)
-                pass_it = 1;
+            if (node->shoutcast == 1)
+            {
+                /* password line */
+                if (strstr (client->refbuf->data, "\r\n") != NULL)
+                    pass_it = 1;
+                if (strstr (client->refbuf->data, "\n") != NULL)
+                    pass_it = 1;
+            }
+            else
+            {
+                if (strstr (client->refbuf->data, "\r\n\r\n") != NULL)
+                    pass_it = 1;
+                if (strstr (client->refbuf->data, "\n\n") != NULL)
+                    pass_it = 1;
+            }
             
             if (pass_it)
             {
@@ -867,9 +878,12 @@
             source_password = strdup (config->source_password);
         config_release_config();
         
-        /* Get rid of trailing \r\n */
+        /* Get rid of trailing \r\n or \n after password */
         ptr = strstr (client->refbuf->data, "\r\n");
         if (ptr == NULL)
+            ptr = strstr (client->refbuf->data, "\n");
+
+        if (ptr == NULL)
         {
             client_destroy (client);
             free (source_password);



More information about the commits mailing list