Fix my recent change for sending large files via the http server. This code

*must* write the file to the FILE *, and not the raw fd.  Otherwise, it breaks
TLS support.

Thanks to rizzo for catching this!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2007-06-29 21:24:40 +00:00
parent 2392758621
commit 4a6f3770f9
4 changed files with 2 additions and 92 deletions

View File

@@ -48,10 +48,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <fcntl.h>
#include <pthread.h>
#ifdef HAVE_SENDFILE
#include <sys/sendfile.h>
#endif
#include "minimime/mm.h"
#include "asterisk/cli.h"
@@ -201,14 +197,8 @@ static struct ast_str *static_callback(struct server_instance *ser, const char *
"Content-type: %s\r\n\r\n",
ASTERISK_VERSION, buf, (int) st.st_size, mtype);
fflush(ser->f);
#ifdef HAVE_SENDFILE
sendfile(ser->fd, fd, NULL, st.st_size);
#else
while ((len = read(fd, buf, sizeof(buf))) > 0)
write(ser->fd, buf, len);
#endif
fwrite(buf, 1, len, ser->f);
close(fd);
return NULL;