From: mtortonesi Date: Thu, 18 Nov 2004 21:05:30 +0000 (-0800) Subject: [svn] Fixed a timeout problem in src/retr.c:fd_read_body when using http_proxy. X-Git-Tag: v1.13~1287 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=14645396e2c5bfec7615ebe2044e2ae5d0910709 [svn] Fixed a timeout problem in src/retr.c:fd_read_body when using http_proxy. --- diff --git a/ChangeLog b/ChangeLog index a8ea9491..a95f837e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,3 @@ -2004-11-15 YAMAZAKI Makoto - - * src/netrc.c: Fix termination by assertion bug in netrc parsing. - 2004-05-09 David Fritz * windows/Makefile.src.bor: Fix broken build rule. Add clean target. diff --git a/src/ChangeLog b/src/ChangeLog index b260efa4..2fc91b81 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2004-11-18 Mauro Tortonesi + + * connect.c: Minor correction to the comment in front of fd_peek. + +2004-11-18 Leonid Petrov + + * retr.c: Fix a timeout problem in fd_read_body when using http_proxy. + +2004-11-15 YAMAZAKI Makoto + + * netrc.c: Fix termination by assertion bug in netrc parsing. + 2004-05-09 David Fritz * mswindows.c (fake_fork): Pass entire command line to the child diff --git a/src/connect.c b/src/connect.c index ffa33cc0..4963512a 100644 --- a/src/connect.c +++ b/src/connect.c @@ -873,8 +873,8 @@ fd_read (int fd, char *buf, int bufsize, double timeout) return sock_read (fd, buf, bufsize); } -/* The same as xread, but don't actually read the data, just copy it - instead. */ +/* The same as fd_read, but don't actually read the data, just find out + what's the number of bytes available for reading. */ int fd_peek (int fd, char *buf, int bufsize, double timeout) diff --git a/src/retr.c b/src/retr.c index d9d03298..605db831 100644 --- a/src/retr.c +++ b/src/retr.c @@ -283,6 +283,13 @@ fd_read_body (int fd, FILE *out, long toread, long startpos, } ret = fd_read (fd, dlbuf, rdsize, tmout); + /* when retrieving from http-proxy wget sometimes does not trust the + * file length reported by server. + * this check is to tell wget not to stubbornly try to read again and + * again until another errno code was received. */ + if ( ret == -1 && errno == ETIMEDOUT && sum_read == toread && toread > 0 ) + break; + if (ret == 0 || (ret < 0 && errno != ETIMEDOUT)) break; /* read error */ else if (ret < 0)