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

Can't parse response to 'EPSV': 227 Entering Passive Mode (91,190,231,97,119,66). #164

Closed
thomaschaaf opened this issue Oct 30, 2020 · 5 comments

Comments

@thomaschaaf
Copy link

Describe the bug
This is only happening with some ftp servers.

Example code

const ftp = require("basic-ftp")

example()

async function example() {
    const client = new ftp.Client()
    client.ftp.verbose = true
    try {
        await client.access({
            host: "###",
            user: "###",
            password: "###",
            secure: false
        })
        console.log(await client.list())
    }
    catch(err) {
        console.log(err)
    }
    client.close()
}

Console output

Connected to ###.###.###.###:21 (No encryption)
< 220 Wilkommen auf dem FTP Server der ###.

Login security: No encryption
> USER ###
< 331 Password required for ###

> PASS ###
< 230 Logged on

> TYPE I
< 200 Type set to I

> STRU F
< 200 Using file structure 'File'

> OPTS UTF8 ON
< 202 UTF8 mode is always enabled. No need to send this command.

> OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;
< 200 MLST OPTS type;size;modify;

Trying to find optimal transfer strategy...
> EPSV
< 227 Entering Passive Mode (91,190,231,97,119,66).

Error: Can't parse response to 'EPSV': 227 Entering Passive Mode (91,190,231,97,119,66).

Which version of Node.js are you using?
v14.6.0

@mofux
Copy link

mofux commented Oct 30, 2020

Looks like the server is responding with the wrong status code. It should respond with 229 status code to the EPSV request. The 227 response code is for the PASV command... 🤔 On what kind of FTP server is this happing?

@thomaschaaf
Copy link
Author

I don't know as I am just using it. It's ftp.blue-technologies.de is there a way to find out without asking them?

@patrickjuchli
Copy link
Owner

patrickjuchli commented Oct 31, 2020

Interesting, the message itself also contains instructions for PASV, not EPSV. I believe that's an error, it should respond with an error code 5xx. This library would then try PASV.

You can force the client to only use PASV like so:

const ftp = require("basic-ftp")
client.prepareTransfer = ftp.enterPassiveModeIPv4

@patrickjuchli
Copy link
Owner

By the way, this seems to be a duplicate: #135.

@patrickjuchli
Copy link
Owner

A new version 4.6.3 might handle this case, let me know if it works.

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

3 participants