From 12f5c67bf5d32baefd27757b8e6bc08683e7bef9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 7 Feb 2006 23:09:04 +0000 Subject: Philippe Vaucher provided a brilliant piece of test code that show a problem with re-used FTP connections. If the second request on the same connection was set not to fetch a "body", libcurl could get confused and consider it an attempt to use a dead connection and would go acting mighty strange. --- lib/transfer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/transfer.c b/lib/transfer.c index 18f8f1124..50a8bae98 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -2100,11 +2100,12 @@ bool Curl_retry_request(struct connectdata *conn, bool retry = FALSE; if((conn->keep.bytecount+conn->headerbytecount == 0) && - conn->bits.reuse) { - /* We got no data and we attempted to re-use a connection. This might - happen if the connection was left alive when we were done using it - before, but that was closed when we wanted to read from it again. Bad - luck. Retry the same request on a fresh connect! */ + conn->bits.reuse && + !conn->bits.no_body) { + /* We got no data, we attempted to re-use a connection and yet we want a + "body". This might happen if the connection was left alive when we were + done using it before, but that was closed when we wanted to read from + it again. Bad luck. Retry the same request on a fresh connect! */ infof(conn->data, "Connection died, retrying a fresh connect\n"); *url = strdup(conn->data->change.url); -- cgit v1.2.3