cURL / Mailing Lists / curl-library / Single Mail

curl-library

Graceful switch from PASV to PORT on failure (like 502)

From: Daniel Cater <djcater_at_gmail.com>
Date: Mon, 16 Jul 2007 23:20:00 +0100

https://sourceforge.net/tracker/index.php?func=detail&aid=1754793&group_id=976&atid=350976

I would really like for a connection to a server not supporting PASV
to fail gracefully and fall back to PORT commands. CURLOPT_FTPPORT "-"
works for such a server, but I would prefer to not use this option, so
that PASV is used where it is supported, and not where it isn't. I
have some servers that return "502 Command not implemented." in
response to PASV, which I don't believe is "weird" as
CURLE_FTP_WEIRD_PASV_REPLY suggests.

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.

Any help would be much appreciated.
Received on 2007-07-17