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

oddsock at motherfish-iii.xiph.org oddsock at motherfish-iii.xiph.org
Mon Nov 15 07:51:00 PST 2004


Author: oddsock
Date: 2004-11-15 07:50:59 -0800 (Mon, 15 Nov 2004)
New Revision: 8201

Modified:
   icecast/trunk/icecast/src/fserve.c
Log:
a few fixes from karl...


Modified: icecast/trunk/icecast/src/fserve.c
===================================================================
--- icecast/trunk/icecast/src/fserve.c	2004-11-15 03:53:16 UTC (rev 8200)
+++ icecast/trunk/icecast/src/fserve.c	2004-11-15 15:50:59 UTC (rev 8201)
@@ -432,20 +432,25 @@
                 time_t now;
                 int strflen;
                 time(&now);
+                struct tm result;
+                int64_t endpos = rangenumber+new_content_len-1;
+                if (endpos < 0) {
+                    endpos = 0;
+                }
                 strflen = strftime(currenttime, 50, "%a, %d-%b-%Y %X GMT",
-                                   gmtime(&now));
+                                   gmtime_r(&now, &result));
                 httpclient->respcode = 206;
                 bytes = sock_write(httpclient->con->sock,
                     "HTTP/1.1 206 Partial Content\r\n"
                     "Date: %s\r\n"
-                    "Content-Length: %ld\r\n"
+                    "Content-Length: " FORMAT_INT64 "\r\n"
                     "Content-Range: bytes " FORMAT_INT64 \
                     "-" FORMAT_INT64 "/" FORMAT_INT64 "\r\n"
                     "Content-Type: %s\r\n\r\n",
                     currenttime,
                     new_content_len,
                     rangenumber,
-                    client->content_length-1,
+                    endpos,
                     client->content_length,
                     fserve_content_type(path));
                 if(bytes > 0) httpclient->con->sent_bytes = bytes;



More information about the commits mailing list