[icecast-dev] icecast 2 compatibility with older clients

Brendan Cully brendan at xiph.org
Wed Jul 2 16:19:54 PDT 2003


I've attached a small patch against icecast 2 which converts ice-
headers to icy- headers for clients that include icy- headers in their
request. This allows a few clients (notably xmms) to pick up stream
info they otherwise miss.

-b
-------------- next part --------------
Index: src/format.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format.c,v
retrieving revision 1.20
diff -u -p -r1.20 format.c
--- src/format.c	15 Mar 2003 02:10:17 -0000	1.20
+++ src/format.c	2 Jul 2003 23:17:53 -0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 4; -*- */
 /* format.c
 **
 ** format plugin implementation
@@ -101,7 +102,11 @@ void format_send_general_headers(format_
     http_var_t *var;
     avl_node *node;
     int bytes;
+    char *client_is_icy;
 
+    /* if the client uses icy headers, we'll respond in kind */
+    client_is_icy = httpp_getvar(client->parser, "icy-metadata");
+    
     /* iterate through source http headers and send to client */
     avl_tree_rlock(source->parser->vars);
     node = avl_get_first(source->parser->vars);
@@ -109,8 +114,12 @@ void format_send_general_headers(format_
         var = (http_var_t *)node->key;
         if (strcasecmp(var->name, "ice-password") && 
                 (!strncasecmp("ice-", var->name, 4) ||
-                 !strncasecmp("icy-", var->name, 4))) { 
-            bytes = sock_write(client->con->sock, 
+                 !strncasecmp("icy-", var->name, 4))) {
+	    if (client_is_icy)
+		bytes = sock_write(client->con->sock, "icy%s:%s\r\n",
+				   var->name + 3, var->value);
+	    else
+		bytes = sock_write(client->con->sock, 
                     "%s: %s\r\n", var->name, var->value);
             if(bytes > 0) client->con->sent_bytes += bytes;
         }

𸬵ªÜ†+Þ²m§ÿðÃb¦+ƒö«r¯zÏâqç²Úk¢7œ¶&z– zm§ÿðÃœyƬ¶Šàý:.žË›±Êâmçë¢kaŠÉb²ÛÖ¦zˁëh‰ÇœjË]zúު笷©†Šàr‰íj)âž
'—+a{
+véì¹»®&ÞŠ{ayºÈÚ,¹¸ÞrجçyÕ'²æìr¸›zg¬±¨²Ç§¶Ú-…éb²Ü"–VÞŠ	è­ç~)mz·


More information about the Icecast-dev mailing list