Commit 5850a9b3 authored by Michael Smith's avatar Michael Smith

Use 64 bit content-length for fileserving (if supported by system)


svn path=/icecast/trunk/icecast/; revision=8196
parent da1f0234
......@@ -10,6 +10,9 @@
* and others (see AUTHORS for details).
*/
#ifndef __COMPAT_H__
#define __COMPAT_H__
/* compat.h
*
* This file contains most of the ugliness for header portability
......@@ -29,3 +32,12 @@
# include <inttypes.h>
# endif
#endif
#ifdef _WIN32
#define FORMAT_INT64 "%I64d"
#else
#define FORMAT_INT64 "%lld"
#endif
#endif /* __COMPAT_H__ */
......@@ -47,6 +47,7 @@
#include "logging.h"
#include "cfgfile.h"
#include "util.h"
#include "compat.h"
#include "fserve.h"
......@@ -379,7 +380,7 @@ int fserve_client_create(client_t *httpclient, char *path)
client->content_length = 0;
client->buf = malloc(BUFSIZE);
if (stat(path, &file_buf) == 0) {
client->content_length = file_buf.st_size;
client->content_length = (int64_t)file_buf.st_size;
}
global_lock();
......@@ -400,7 +401,7 @@ int fserve_client_create(client_t *httpclient, char *path)
httpclient->respcode = 200;
bytes = sock_write(httpclient->con->sock,
"HTTP/1.0 200 OK\r\n"
"Content-Length: %ld\r\n"
"Content-Length: " FORMAT_INT64 "\r\n"
"Content-Type: %s\r\n\r\n",
client->content_length,
fserve_content_type(path));
......
......@@ -14,6 +14,7 @@
#define __FSERVE_H__
#include <stdio.h>
#include "compat.h"
typedef struct _fserve_t
{
......@@ -21,7 +22,7 @@ typedef struct _fserve_t
FILE *file;
int offset;
off_t content_length;
int64_t content_length;
int datasize;
int ready;
unsigned char *buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment