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.
This commit is contained in:
Daniel Stenberg 2006-02-07 23:09:04 +00:00
parent d7a83d8995
commit 12f5c67bf5
3 changed files with 16 additions and 8 deletions

View File

@ -6,6 +6,12 @@
Changelog Changelog
Daniel (8 February 2006)
- 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.
Daniel (2 February 2006) Daniel (2 February 2006)
- Make --limit-rate [num] mean bytes. It used to be that but it broke in my - Make --limit-rate [num] mean bytes. It used to be that but it broke in my
change done in November 2005. change done in November 2005.
@ -18,8 +24,7 @@ Daniel (30 January 2006)
- Based on an error report by Philippe Vaucher, we no longer count a retried - Based on an error report by Philippe Vaucher, we no longer count a retried
connection setup as a follow-redirect. It turns out 1) this fails when a FTP connection setup as a follow-redirect. It turns out 1) this fails when a FTP
connection is re-setup and 2) it does make the max-redirs counter behave connection is re-setup and 2) it does make the max-redirs counter behave
wrong. This fix was not verified since the reporter vanished, but I believe wrong.
this is the right fix nonetheless.
Daniel (24 January 2006) Daniel (24 January 2006)
- Michal Marek provided a patch for FTP that makes libcurl continue to try - Michal Marek provided a patch for FTP that makes libcurl continue to try

View File

@ -20,6 +20,7 @@ This release includes the following changes:
This release includes the following bugfixes: This release includes the following bugfixes:
o re-used FTP connections when the second request didn't do a transfer
o plain --limit-rate [num] means bytes o plain --limit-rate [num] means bytes
o re-creating a dead connection is no longer counted internally as a followed o re-creating a dead connection is no longer counted internally as a followed
redirect and thus prevents a weird error that would occur if a FTP redirect and thus prevents a weird error that would occur if a FTP
@ -49,6 +50,7 @@ Other curl-related news since the previous public release:
o http://curl.s-lines.net/ is a new curl web mirror in Japan o http://curl.s-lines.net/ is a new curl web mirror in Japan
o http://curl.oss-mirror.org/ is a new curl web mirror in Ireland o http://curl.oss-mirror.org/ is a new curl web mirror in Ireland
o http://curl.linux-mirror.org/ is a new curl web mirror in Germany o http://curl.linux-mirror.org/ is a new curl web mirror in Germany
o pycurl 7.15.1 was released: http://pycurl.sf.net/
o TclCurl 0.15.1 was released: o TclCurl 0.15.1 was released:
http://personal1.iddeo.es/andresgarci/tclcurl/english/ http://personal1.iddeo.es/andresgarci/tclcurl/english/

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * 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; bool retry = FALSE;
if((conn->keep.bytecount+conn->headerbytecount == 0) && if((conn->keep.bytecount+conn->headerbytecount == 0) &&
conn->bits.reuse) { conn->bits.reuse &&
/* We got no data and we attempted to re-use a connection. This might !conn->bits.no_body) {
happen if the connection was left alive when we were done using it /* We got no data, we attempted to re-use a connection and yet we want a
before, but that was closed when we wanted to read from it again. Bad "body". This might happen if the connection was left alive when we were
luck. Retry the same request on a fresh connect! */ 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"); infof(conn->data, "Connection died, retrying a fresh connect\n");
*url = strdup(conn->data->change.url); *url = strdup(conn->data->change.url);