From 3fb4d068a7bf31c362ddeac1627c9253d2c1613f Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 23 May 2011 20:27:42 +0200 Subject: [PATCH] Avoid a small buffer when retrieving a file. --- src/ChangeLog | 4 ++++ src/retr.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 56d6def4..c88740b5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-05-23 Giuseppe Scrivano + * retr.c (fd_read_body): Be sure the buffer size is at least 8Kb. + BUFSIZ may assume very small values with a negative impact on the + performances. + * mswindows.h [NEED_GAI_STRERROR]: remove definition for gai_strerror. 2011-05-15 Ray Satiro diff --git a/src/retr.c b/src/retr.c index 25c5dcf4..585cccb6 100644 --- a/src/retr.c +++ b/src/retr.c @@ -208,8 +208,8 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos, { int ret = 0; - int dlbufsize = BUFSIZ; - char *dlbuf = xmalloc (BUFSIZ); + int dlbufsize = max (BUFSIZ, 8 * 1024); + char *dlbuf = xmalloc (dlbufsize); struct ptimer *timer = NULL; double last_successful_read_tm = 0;