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

karl at svn.xiph.org karl at svn.xiph.org
Sun Aug 14 19:07:52 PDT 2005


Author: karl
Date: 2005-08-14 19:07:50 -0700 (Sun, 14 Aug 2005)
New Revision: 9752

Modified:
   icecast/branches/kh/icecast/src/fserve.c
Log:
someone reported a quicktime hack needed for m3u, needing icy:// links


Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2005-08-13 20:35:25 UTC (rev 9751)
+++ icecast/branches/kh/icecast/src/fserve.c	2005-08-15 02:07:50 UTC (rev 9752)
@@ -412,6 +412,12 @@
         char *host = httpp_getvar (httpclient->parser, "host");
         char *sourceuri = strdup (path);
         char *dot = strrchr (sourceuri, '.');
+        char *protocol = "http";
+        char *agent = httpp_getvar (httpclient->parser, "user-agent");
+
+        if (agent && (strstr (agent, "QTS") || strstr (agent, "QuickTime")))
+            protocol = "icy";
+
         *dot = 0;
         httpclient->respcode = 200;
         if (host == NULL)
@@ -420,7 +426,8 @@
             snprintf (httpclient->refbuf->data, BUFSIZE,
                     "HTTP/1.0 200 OK\r\n"
                     "Content-Type: audio/x-mpegurl\r\n\r\n"
-                    "http://%s:%d%s\r\n", 
+                    "%s://%s:%d%s\r\n", 
+                    protocol,
                     config->hostname, config->port,
                     sourceuri
                     );
@@ -431,7 +438,8 @@
             snprintf (httpclient->refbuf->data, BUFSIZE,
                     "HTTP/1.0 200 OK\r\n"
                     "Content-Type: audio/x-mpegurl\r\n\r\n"
-                    "http://%s%s\r\n", 
+                    "%s://%s%s\r\n", 
+                    protocol,
                     host, 
                     sourceuri
                     );



More information about the commits mailing list