diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-29 21:24:40 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-29 21:24:40 +0000 |
commit | 14d66dd72cdeb657bab548319cdc5ecf800653e6 (patch) | |
tree | 45bd741392c5eea6f6512dae3be9ee1421a7b2b2 /main/http.c | |
parent | 132c6654622343091e31abe1c31775963bc7bc51 (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: http://svn.digium.com/svn/asterisk/trunk@72738 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/http.c')
-rw-r--r-- | main/http.c | 12 |
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; |