curl-library
Re: Graceful switch from PASV to PORT on failure (like 502)
Date: Tue, 17 Jul 2007 00:42:24 +0200 (CEST)
On Mon, 16 Jul 2007, Daniel Cater wrote:
> Unfortunately I can't work out how to fix it, which is why I'm posting here.
> I noticed the conn->bits.ftp_use_port and conn->bits.ftpport settings and
> also state(conn, FTP_PORT); but I don't understand the internals enough to
> work out how to use these to solve the problem, or even if they're
> irrelevant entirely.
Since the connecting of the second data connection is done rather differently
in the two forks (PASV vs PORT) I would rather say that such a switch could be
easier done by doing this code like this:
1) detect the PASV failure, set the internal option for the connection that
PASV is disabled and PORT is mandated
2) set data->reqdata.newurl to the same URL and return back, and allow the
follow-redirection logic to start over the fetch
3) the "redirected" fetch will re-use the connection since it is still alive
4) this time it'll use PORT
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2007-07-17