mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 20:56:39 +00:00
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:
12
main/http.c
12
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;
|
||||
|
Reference in New Issue
Block a user