summaryrefslogtreecommitdiff
path: root/main/http.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-06-29 21:24:40 +0000
committerRussell Bryant <russell@russellbryant.com>2007-06-29 21:24:40 +0000
commit4a6f3770f9e0b96956be68a3e530e286134c856d (patch)
tree45bd741392c5eea6f6512dae3be9ee1421a7b2b2 /main/http.c
parent2392758621b05823c224a0b5e5d7bc74c2f29137 (diff)
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
Diffstat (limited to 'main/http.c')
-rw-r--r--main/http.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/main/http.c b/main/http.c
index f71ae0dfb..d8471740c 100644
--- a/main/http.c
+++ b/main/http.c
@@ -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;