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

get stuck, no call back #53

Closed
evandavey opened this issue Jul 19, 2013 · 3 comments
Closed

get stuck, no call back #53

evandavey opened this issue Jul 19, 2013 · 3 comments

Comments

@evandavey
Copy link

I can connect and download test.txt via a normal ftp client but the get callback never gets called using the code below. If I try an incorrect filename an error gets correctly thrown. Tried with and without the leading './'

coffee code:

c.on 'ready',->
    c.get "./test.txt",(err,stream) ->
        if err
            throw err
        stream.once 'close', -> 
            c.end()
        stream.pipe(fs.createWriteStream('foo.local-copy.txt'))

debug:

[connection] < '220 ProFTPD 1.3.4a Server (Debian) [::ffff:192.168.0.20]\r\n'
[parser] < '220 ProFTPD 1.3.4a Server (Debian) [::ffff:192.168.0.20]\r\n'
[parser] Response: code=220, buffer='ProFTPD 1.3.4a Server (Debian) [::ffff:192.0.168.20]'
[connection] > 'USER localadmin'
[connection] < '331 Password required for localadmin\r\n'
[parser] < '331 Password required for localadmin\r\n'
[parser] Response: code=331, buffer='Password required for localadmin'
[connection] > 'PASS XXXXXX'
[connection] < '230 User localadmin logged in\r\n'
[parser] < '230 User localadmin logged in\r\n'
[parser] Response: code=230, buffer='User localadmin logged in'
[connection] > 'FEAT'
[connection] < '211-Features:\r\n LANG en-US.UTF-8;en-US*\r\n MDTM\r\n MFMT\r\n TVFS\r\n UTF8\r\n MFF modify;UNIX.group;UNIX.mode;\r\n MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;\r\n SITE MKDIR\r\n SITE RMDIR\r\n SITE UTIME\r\n SITE SYMLINK\r\n REST STREAM\r\n SITE COPY\r\n SIZE\r\n'
[connection] < '211 End\r\n'
[parser] < '211-Features:\r\n LANG en-US.UTF-8;en-US*\r\n MDTM\r\n MFMT\r\n TVFS\r\n UTF8\r\n MFF modify;UNIX.group;UNIX.mode;\r\n MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;\r\n SITE MKDIR\r\n SITE RMDIR\r\n SITE UTIME\r\n SITE SYMLINK\r\n REST STREAM\r\n SITE COPY\r\n SIZE\r\n211 End\r\n'
[parser] Response: code=211, buffer='Features:\r\n LANG en-US.UTF-8;en-US*\r\n MDTM\r\n MFMT\r\n TVFS\r\n UTF8\r\n MFF modify;UNIX.group;UNIX.mode;\r\n MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;\r\n SITE MKDIR\r\n SITE RMDIR\r\n SITE UTIME\r\n SITE SYMLINK\r\n REST STREAM\r\n SITE COPY\r\n SIZE\r\nEnd'
[connection] > 'TYPE I'
[connection] < '200 Type set to I\r\n'
[parser] < '200 Type set to I\r\n'
[parser] Response: code=200, buffer='Type set to I'
[connection] > 'PASV'
[connection] < '227 Entering Passive Mode (192,168,0,20,200,240).\r\n'
[parser] < '227 Entering Passive Mode (192,168,0,20,200,240).\r\n'
[parser] Response: code=227, buffer='Entering Passive Mode (192,168,0,20,200,240).'
[connection] > 'RETR ./test.txt'
@evandavey evandavey reopened this Jul 19, 2013
@mscdex
Copy link
Owner

mscdex commented Jul 19, 2013

The server should be sending back some kind of response after the RETR command. What does the server log say?

Did you mean to say it works without the preceding "./" ?

@evandavey
Copy link
Author

Yes, looks like a server issue (security violation) - I needed to add

AllowForeignAddress on

However, is it a bug that your library never timed out or reported an error?

@mscdex
Copy link
Owner

mscdex commented Jul 19, 2013

There is a timeout for the actual PASV connection and one for connecting to the FTP server itself, but not for individual commands. You could easily do a setTimeout() though if you need to.

In this particular case there is no way to know that it was a server misconfiguration. There could be other causes, like a very slow or unreliable network connection.

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