cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: EPSV vs PASV

From: Leo <leo.r_at_rogers.com>
Date: Wed, 19 Jan 2011 22:37:19 -0500

On 1/19/11 2:07:46 PM, Daniel Stenberg wrote:

Thanks and I apologize for top-posting - just didn't pay attention.

I've been using curl for over 5 years already, never had any problems,
that's why I never really needed this group. :) It's been easy enough to
use to never require any assistance, rock solid and problem-free. That's
why I never really had to investigate or understand in depth what
EPSV/PASV do and why.

>> -Is there a way to connect to such servers without disabling EPSV?
>> (But then it can't be used universally).
>
> I don't know. I think we need more details and facts first.

OK, here's an example of one such FTP server. curl can't connect without
disabling EPSV: it waits for over a minute then fails. Cyberduck
connects without problems, and so does curl with EPSV disabled.

I'm on Mac OS X 10.5.8 with libcurl 7.16.3

Below are 3 logs:

1. Cyberduck connects as is.
------------------------

220 Canwest File Transfer Server
FEAT
530 Please login with USER and PASS.
USER calgaryadupload
331 Password required for calgaryadupload.
PASS ********
230 Login OK. Proceed.
PWD
257 "/" is current folder.
NOOP
200 Command OK.
SYST
215 UNIX Type: L8
STAT /
211-FTP server status:
     Connected to 99.231.98.177 at Wednesday, January 19, 2011, 14:39:34
     Logged in as CA\calgaryadupload
     TYPE: ASCII, STRUcture: File, transfer MODE: Stream
     No data connection.
211 End of status
PASV
227 Entering Passive Mode (204,187,151,151,16,78)
LIST -a
150 Opening ASCII mode data connection for file list.
drwxrw-rw- 1 user group 0 Jan 19 13:49 Admin
226 Transfer complete. 62 bytes transferred. 62 bps.

2. libcurl fails with EPSV
--------------------

* About to connect() to ftp.postmedia.com port 21 (#0)
* Trying 204.187.151.151... connected
* Connected to ftp.postmedia.com (204.187.151.151) port 21 (#0)
< 220 Canwest File Transfer Server
> USER calgaryadupload
< 331 Password required for calgaryadupload.
> PASS <********>
< 230 Login OK. Proceed.
> PWD
< 257 "/" is current folder.
* Entry path is '/'
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||4212|)

<some 75 sec wait here>

* Trying 204.187.151.151... Operation timed out
* couldn't connect to host
* got positive EPSV response, but can't connect. Disabling EPSV
> PASV
< 425 Data connection already open.
* Bad PASV/EPSV response: 425
* Remembering we are in dir ""
* Connection #0 to host ftp.postmedia.com left intact
curl: (13) Bad PASV/EPSV response: 425
> QUIT
< 221 Service closing control connection.
* Closing connection #0

3. libcurl connects instantly with EPSV disabled
---------------------------------------

* About to connect() to ftp.postmedia.com port 21 (#0)
* Trying 204.187.151.151... connected
* Connected to ftp.postmedia.com (204.187.151.151) port 21 (#0)
< 220 Canwest File Transfer Server
> USER calgaryadupload
< 331 Password required for calgaryadupload.
> PASS <********>
< 230 Login OK. Proceed.
> PWD
< 257 "/" is current folder.
* Entry path is '/'
> PASV
* Connect data stream passively
< 227 Entering Passive Mode (204,187,151,151,16,230)
* Trying 204.187.151.151... connected
* Connecting to 204.187.151.151 (204.187.151.151) port 4326
> TYPE A
< 200 Type set to A.
> LIST
< 150 Opening ASCII mode data connection for file list.
* Maxdownload = -1
drwxrw-rw- 1 user group 0 Jan 19 13:49 Admin
* Remembering we are in dir ""
< 226 Transfer complete. 62 bytes transferred. 62 bps.
* Connection #0 to host ftp.postmedia.com left intact
> QUIT
< 221 Service closing control connection.
* Closing connection #0

Thanks,
Leo

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-20