[xiph-commits] r8192 - icecast/trunk/icecast/src
oddsock at motherfish-iii.xiph.org
oddsock at motherfish-iii.xiph.org
Thu Nov 11 08:21:02 PST 2004
Author: oddsock
Date: 2004-11-11 08:21:01 -0800 (Thu, 11 Nov 2004)
New Revision: 8192
Modified:
icecast/trunk/icecast/src/fserve.c
icecast/trunk/icecast/src/fserve.h
Log:
add Content-Length to files served via the fserve to enable seeking
Modified: icecast/trunk/icecast/src/fserve.c
===================================================================
--- icecast/trunk/icecast/src/fserve.c 2004-11-11 15:47:33 UTC (rev 8191)
+++ icecast/trunk/icecast/src/fserve.c 2004-11-11 16:21:01 UTC (rev 8192)
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <sys/stat.h>
#ifdef HAVE_POLL
#include <sys/poll.h>
@@ -360,6 +361,7 @@
int bytes;
int client_limit;
ice_config_t *config = config_get_config();
+ struct stat file_buf;
client_limit = config->client_limit;
config_release_config();
@@ -374,7 +376,11 @@
client->offset = 0;
client->datasize = 0;
client->ready = 0;
+ client->content_length = 0;
client->buf = malloc(BUFSIZE);
+ if (stat(path, &file_buf) == 0) {
+ client->content_length = file_buf.st_size;
+ }
global_lock();
if(global.clients >= client_limit) {
@@ -394,7 +400,9 @@
httpclient->respcode = 200;
bytes = sock_write(httpclient->con->sock,
"HTTP/1.0 200 OK\r\n"
+ "Content-Length: %ld\r\n"
"Content-Type: %s\r\n\r\n",
+ client->content_length,
fserve_content_type(path));
if(bytes > 0) httpclient->con->sent_bytes = bytes;
Modified: icecast/trunk/icecast/src/fserve.h
===================================================================
--- icecast/trunk/icecast/src/fserve.h 2004-11-11 15:47:33 UTC (rev 8191)
+++ icecast/trunk/icecast/src/fserve.h 2004-11-11 16:21:01 UTC (rev 8192)
@@ -21,6 +21,7 @@
FILE *file;
int offset;
+ off_t content_length;
int datasize;
int ready;
unsigned char *buf;
More information about the commits
mailing list