curb icon indicating copy to clipboard operation
curb copied to clipboard

NLST command not working

Open rushirajchavan opened this issue 12 years ago • 3 comments

Hi,

I am using curb to execute NLST command on a remote ftp server through a http proxy server. Proxy tunneling is enabled.

require

require 'rubygems' require 'curb'

configuration

curl_handle.url="ftp://some_ftp_site:21" curl_handle.userpwd="user:pass" curl_handle.proxy_url="http://some_proxy:80" curl_handle.verbose = true curl_handle.ftp_commands=["PASV","NLST"] curl_handle.proxy_tunnel=(true)

perform

curl_handle.perform

I am getting the following error,

Output:

  • About to connect() to proxy port 80 (#0)
  • Trying 148.87.19.20... * Connected to port 80 (#0)
  • Establish HTTP proxy tunnel to ftp.kernel.org:21

    CONNECT ftp.kernel.org:21 HTTP/1.1 Host: ftp.kernel.org:21 Proxy-Connection: Keep-Alive

< HTTP/1.0 200 Connection established < Proxy replied OK to CONNECT request Connected to port 80 (#0) < 220 Welcome to kernel.org

USER anonymous < 331 Please specify the password. PASS [email protected] < 230 Login successful. PWD < 257 "/" Entry path is '/' PASV < 227 Entering Passive Mode (x,x,x,x,119,60). NLST < 425 Failed to establish connection. QUOT command failed with 425 Closing connection #0

Can anybody help?

Thanks, Rushi

rushirajchavan avatar Oct 30 '13 07:10 rushirajchavan

Hi Rushi,

I would start by looking into the libcurl documentation here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html Also see if you can find some examples in the C API. it should translate to the Ruby API fairly close... and from there I would look in ext/curb_easy.c

I've have not tried connecting using the Ruby API via NLST - so it's possible we might need to make some changes.

Todd

taf2 avatar Nov 03 '13 01:11 taf2

Thank you Todd. I will try to find c api.

rushirajchavan avatar Nov 11 '13 04:11 rushirajchavan

Hi Todd,

I found the problem.

With ruby curb gem, client is not connecting to passive port specified by the server in the reply to EPSV command. That is why NLST command times out.

I tried command line tool curl with NLST option set. It connects to the server via passive port and every thing works fine.

This may help you to locate the error in the code.

Thanks,

Rushi

rushirajchavan avatar Nov 11 '13 07:11 rushirajchavan