【发布时间】:2011-01-22 05:52:10
【问题描述】:
我在使用 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 似乎是不可能的,没有这样的选项。在这种情况下可以做什么?
【问题讨论】:
-
Digg 这个问题,我也遇到过这个问题——我可以在 curl 中使用 --disable-epsv 但似乎无法在 CURB 中设置?在 C API 中它显示 CURLOPT_FTP_USE_EPSV 是一个选项,但我没有看到它在遏制中可用
-
最后我用反引号调用了正常的 curl。