我在使用 Curb(ruby curl 绑定)进行 FTP 下载时遇到问题。
当扩展被动模式失败时,路缘似乎不会退回到简单的被动模式。从日志中提取如下:
< 250 Directory changed to /outgoing/productcatalog/35591
> EPSV
* Connect data stream passively
< 229 Entering Passive Mode (|||40938|)
* Trying 216.34.207.42... * Connecting to 216.34.207.42 (216.34.207.42) port 40938
* Connection failed
* Expire cleared
* Closing connection #0
然后抛出 Curl::Err::ConnectionFailedError: could't connect to server
但是,如果我在命令行中使用 curl,我会得到
< 250 Directory changed to /outgoing/productcatalog/35591
> EPSV
* Connect data stream passively
< 229 Entering Passive Mode (|||43267|)
* Trying 216.34.207.42... Connection refused
* couldn't connect to host
* got positive EPSV response, but can't connect. Disabling EPSV
> PASV
< 227 Entering Passive Mode (216,34,207,42,169,4)
* Trying 216.34.207.42... connected
解决方案是完全禁用 epsv,但使用 Curb 似乎是不可能的,没有这样的选项。在这种情况下可以做些什么?