mscdex / node-ftp

An FTP client module for node.js
MIT License
1.13k stars 243 forks source link

Support return code 200 for authentication #166

Closed patrickjuchli closed 7 years ago

patrickjuchli commented 7 years ago

VxWorks FTP Server is used in many embedded devices and returns 200 (not 234) when accepting authentication using “AUTH TLS” or “AUTH SSL”. The current version of node-ftp doesn't handle this case and will hang.

This pull request will accept a return code of 200. Here is an example with VxWorks FTP Server:

[connection] < '220 VxWorks FTP server (VxWorks VxWorks5.5.1) ready.\r\n'
[parser] < '220 VxWorks FTP server (VxWorks VxWorks5.5.1) ready.\r\n'
[parser] Response: code=220, buffer='VxWorks FTP server (VxWorks VxWorks5.5.1) ready.'
[connection] > 'AUTH TLS'
[connection] < '200 AUTH command ok; starting SSL connection...\r\n'
[parser] < '200 AUTH command ok; starting SSL connection...\r\n'
[parser] Response: code=200, buffer='AUTH command ok; starting SSL connection...'

According to this list of FTP server return codes, the return code 234 is nonstandard anyway which was surprising to me. Maybe that will make it easier for node-ftp to accept 200 as well?

patrickjuchli commented 7 years ago

This pull request doesn't fix the problem, will submit a new one.