Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLST command not working #171

Open
rushirajchavan opened this issue Oct 30, 2013 · 3 comments
Open

NLST command not working #171

rushirajchavan opened this issue Oct 30, 2013 · 3 comments

Comments

@rushirajchavan
Copy link

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

@taf2
Copy link
Owner

taf2 commented Nov 3, 2013

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

@rushirajchavan
Copy link
Author

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

@rushirajchavan
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants