cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Big problems with EPSV

From: Eric VERGNAUD <eric.vergnaud_at_jlynx.com>
Date: Wed, 26 May 2004 19:35:29 +0200

le 26/05/04 19:16, Eric VERGNAUD à eric.vergnaud_at_jlynx.com a écrit :

> Hi,
>
> I've always encountered big problems with EPSV so I simply took the habit of
> disabling it.
>
> Now one of my users needs to connect to a server which supports EPSV but not
> PASV.
>
> The initial connection on port 21 works fine. Then curl sends an EPSV
> command. The reply is:
>
> 229 Entering Extended Passive Mode (|||82|)
>
> The subsequent connection on port 82 ALWAYS fails.
>
> When connecting from IE, the connection works fine, so my guess is that the
> secondary socket requires specific settings in order to succeed.
>
> Any clue ?

The RFC 2426 says:

3. The EPSV Command

   The EPSV command requests that a server listen on a data port and
   wait for a connection. The EPSV command takes an optional argument.
   The response to this command includes only the TCP port number of the
   listening connection. The format of the response, however, is
   similar to the argument of the EPRT command. This allows the same
   parsing routines to be used for both commands. In addition, the
   format leaves a place holder for the network protocol and/or network
   address, which may be needed in the EPSV response in the future. The
   response code for entering passive mode using an extended address
   MUST be 229. The interpretation of this code, according to [PR85]
   is:

        2yz Positive Completion
        x2z Connections
        xy9 Extended Passive Mode Entered

   The text returned in response to the EPSV command MUST be:

        <text indicating server is entering extended passive mode> \
            (<d><d><d><tcp-port><d>)

   The portion of the string enclosed in parentheses MUST be the exact
   string needed by the EPRT command to open the data connection, as
   specified above.

Does this mean the ftp client MUST issue an EPRT command after receiving a
successful EPSV reply ?

In that case, could it be that the EPRT command should be sent BEFORE
attempting to establish the secondary connection on the port returned by
EPSV, so that the server indeed opens that port ?

-------------------------------
Eric VERGNAUD - JLynx Software
Cutting-edge technologies and
services for software companies
web: http://www.jlynx.com
-------------------------------
Received on 2004-05-26