我在使用Curb(ruby curl绑定)进行FTP下载时遇到了问题。
当扩展被动模式失败时,看起来curb不会回退到简单的被动模式。从日志中提取如下:
< 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:无法连接到服务器
但是,如果我在命令行中使用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似乎不可能,没有这样的选择。在这种情况下可以做些什么?
答案 0 :(得分:0)
禁用EPSV的libcurl选项是一个简单的布尔选项,curb应该已经支持许多其他类似的选项。添加对此的支持应该是相当简单的。