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

karl at svn.xiph.org karl at svn.xiph.org
Fri Oct 19 07:06:07 PDT 2007


Author: karl
Date: 2007-10-19 07:06:07 -0700 (Fri, 19 Oct 2007)
New Revision: 14014

Modified:
   icecast/trunk/icecast/src/format.c
   icecast/trunk/icecast/src/format_mp3.c
Log:
header fixup for listeners. Tell any proxies to not cache and add minor tweaks
for flash players. closes #1115


Modified: icecast/trunk/icecast/src/format.c
===================================================================
--- icecast/trunk/icecast/src/format.c	2007-10-18 18:43:41 UTC (rev 14013)
+++ icecast/trunk/icecast/src/format.c	2007-10-19 14:06:07 UTC (rev 14014)
@@ -347,6 +347,11 @@
     remaining -= bytes;
     ptr += bytes;
 
+    /* prevent proxy servers from caching */
+    bytes = snprintf (ptr, remaining, "Cache-Control: no-cache\r\n");
+    remaining -= bytes;
+    ptr += bytes;
+
     bytes = snprintf (ptr, remaining, "\r\n");
     remaining -= bytes;
     ptr += bytes;

Modified: icecast/trunk/icecast/src/format_mp3.c
===================================================================
--- icecast/trunk/icecast/src/format_mp3.c	2007-10-18 18:43:41 UTC (rev 14013)
+++ icecast/trunk/icecast/src/format_mp3.c	2007-10-19 14:06:07 UTC (rev 14014)
@@ -638,16 +638,24 @@
     unsigned remaining = 4096 - client->refbuf->len + 2;
     char *ptr = client->refbuf->data + client->refbuf->len - 2;
     int bytes;
+    const char *useragent;
 
     if (client_mp3 == NULL)
         return -1;
 
-    /* hack for flash player, it wants a length */
-    if (httpp_getvar(client->parser, "x-flash-version"))
+    /* hack for flash player, it wants a length.  It has also been reported that the useragent
+     * appears as MSIE if run in internet explorer */
+    useragent = httpp_getvar (client->parser, "user-agent");
+    if (httpp_getvar(client->parser, "x-flash-version") ||
+            (useragent && strstr(useragent, "MSIE")))
     {
-        bytes = snprintf (ptr, remaining, "Content-Length: 347122319\r\n");
+        bytes = snprintf (ptr, remaining, "Content-Length: 221183499\r\n");
         remaining -= bytes;
         ptr += bytes;
+        /* avoid browser caching, reported via forum */
+        bytes = snprintf (ptr, remaining, "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n");
+        remaining -= bytes;
+        ptr += bytes; 
     }
 
     client->format_data = client_mp3;



More information about the commits mailing list