Merge pull request #10 from stewarttylerr/sandbotorg-master
Sandbotorg master
This commit is contained in:
@@ -132,7 +132,7 @@ Returns new directory relative to cwd
|
|||||||
> Used in `CWD`, `CDUP`
|
> Used in `CWD`, `CDUP`
|
||||||
|
|
||||||
`mkdir(path)`
|
`mkdir(path)`
|
||||||
Return a path to a newly created directory
|
Returns a path to a newly created directory
|
||||||
|
|
||||||
> Used in `MKD`
|
> Used in `MKD`
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ Modify a file or directory's permissions
|
|||||||
> Used in `SITE CHMOD`
|
> Used in `SITE CHMOD`
|
||||||
|
|
||||||
`getUniqueName()`
|
`getUniqueName()`
|
||||||
Return a unique file name to write to
|
Returns a unique file name to write to
|
||||||
|
|
||||||
> Used in `STOU`
|
> Used in `STOU`
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const commands = [
|
|||||||
require('./registration/pasv'),
|
require('./registration/pasv'),
|
||||||
require('./registration/port'),
|
require('./registration/port'),
|
||||||
require('./registration/pwd'),
|
require('./registration/pwd'),
|
||||||
|
require('./registration/quit'),
|
||||||
require('./registration/retr'),
|
require('./registration/retr'),
|
||||||
require('./registration/rmd'),
|
require('./registration/rmd'),
|
||||||
require('./registration/rnfr'),
|
require('./registration/rnfr'),
|
||||||
|
|||||||
@@ -42,12 +42,10 @@ class FtpConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(code = 421, message = 'Closing connection') {
|
close(code = 421, message = 'Closing connection') {
|
||||||
return when(() => {
|
return when
|
||||||
if (code) return this.reply(code, message);
|
.resolve(code)
|
||||||
})
|
.then(code => code && this.reply(code, message))
|
||||||
.then(() => {
|
.then(() => this.commandSocket && this.commandSocket.end());
|
||||||
if (this.commandSocket) this.commandSocket.end();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
login(username, password) {
|
login(username, password) {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ describe('Connector - Passive //', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('has invalid pasv range', function (done) {
|
it('has invalid pasv range', function (done) {
|
||||||
delete mockConnection.server.options.pasv_range;
|
mockConnection.server.options.pasv_range = -1;
|
||||||
|
|
||||||
passive.setupServer()
|
passive.setupServer()
|
||||||
.then(() => done('should not happen'))
|
.then(() => done('should not happen'))
|
||||||
@@ -85,7 +85,8 @@ describe('Connector - Passive //', function () {
|
|||||||
expect(passive.dataServer).to.exist;
|
expect(passive.dataServer).to.exist;
|
||||||
|
|
||||||
const {port} = passive.dataServer.address();
|
const {port} = passive.dataServer.address();
|
||||||
net.createConnection(port, () => {
|
net.createConnection(port);
|
||||||
|
passive.dataServer.once('connection', () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
expect(passive.connection.reply.callCount).to.equal(1);
|
expect(passive.connection.reply.callCount).to.equal(1);
|
||||||
expect(passive.connection.reply.args[0][0]).to.equal(550);
|
expect(passive.connection.reply.args[0][0]).to.equal(550);
|
||||||
|
|||||||
@@ -235,4 +235,10 @@ describe('FtpServer', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('QUIT', done => {
|
||||||
|
client.once('close', done)
|
||||||
|
client.logout(err => {
|
||||||
|
expect(err).to.be.undefined;
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user