From cafe798fec218327ee622d8d1c8e8976705f6e90 Mon Sep 17 00:00:00 2001 From: hniksic Date: Sun, 13 Jan 2002 17:39:16 -0800 Subject: [PATCH] [svn] Invalidate socket if get_contents encountered an error. Published in . --- src/ChangeLog | 5 +++++ src/http.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index eed212c8..790a8527 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-01-14 Hrvoje Niksic + + * http.c (gethttp): Invalidate SOCK if get_contents encountered an + error. + 2001-12-24 Hrvoje Niksic * version.c: Wget 1.8.1 is released. diff --git a/src/http.c b/src/http.c index ad354eed..b615df96 100644 --- a/src/http.c +++ b/src/http.c @@ -1357,6 +1357,11 @@ Refusing to truncate existing file `%s'.\n\n"), *hs->local_file); (contlen != -1 ? contlen : 0), &rbuf, keep_alive, &hs->dltime); + if (hs->res >= 0) + CLOSE_FINISH (sock); + else + CLOSE_INVALIDATE (sock); + { /* Close or flush the file. We have to be careful to check for error here. Checking the result of fwrite() is not enough -- @@ -1370,7 +1375,6 @@ Refusing to truncate existing file `%s'.\n\n"), *hs->local_file); hs->res = -2; } FREE_MAYBE (all_headers); - CLOSE_FINISH (sock); if (hs->res == -2) return FWRITEERR; return RETRFINISHED; -- 2.39.2