From 7e1c434415711ec11ab05f50fd6a898d16eb133e Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Thu, 11 Jul 2013 13:22:43 +0200 Subject: [PATCH] Set sock variable to -1 if no persistent conn exists Wget should set sock variable to -1 if no persistent connection exists. Function persistent_available_p() tests persistent connection but if test_socket_open() fails it closes the socket but will not set sock variable to -1. After returning from persistent_available_p() it is possible that sock has still value of already closed connection. Signed-off-by: Tomas Hozza --- src/ChangeLog | 5 +++++ src/http.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 5b978eb..e5214b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-03-20 Tomas Hozza (tiny change) + + * http.c (gethttp): Set "sock" to -1 if it's not and we have no + persistent connection + 2013-04-26 Tomas Hozza (tiny change) * log.c (redirect_output): Use DEFAULT_LOGFILE in diagnostic message diff --git a/src/http.c b/src/http.c index 669f0fe..a693355 100644 --- a/src/http.c +++ b/src/http.c @@ -1983,6 +1983,10 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy, exec_name, quote (relevant->host)); return HOSTERR; } + else if (sock != -1) + { + sock = -1; + } } if (sock < 0) -- 1.8.3.1