add support for the venerable FTP protocol

Fixes #46
This commit is contained in:
Nicola Murino
2020-07-29 21:56:56 +02:00
parent cc2f04b0e4
commit 93ce96d011
38 changed files with 3075 additions and 160 deletions

View File

@@ -30,7 +30,7 @@ type scpCommand struct {
func (c *scpCommand) handle() error {
common.Connections.Add(c.connection)
defer common.Connections.Remove(c.connection)
defer common.Connections.Remove(c.connection.GetID())
var err error
destPath := c.getDestPath()
@@ -226,7 +226,7 @@ func (c *scpCommand) handleUploadFile(resolvedPath, filePath string, sizeToRead
baseTransfer := common.NewBaseTransfer(file, c.connection.BaseConnection, cancelFn, resolvedPath, requestPath,
common.TransferUpload, 0, initialSize, isNewFile)
t := newTranfer(baseTransfer, w, nil, maxWriteSize)
t := newTransfer(baseTransfer, w, nil, maxWriteSize)
return c.getUploadFileData(sizeToRead, t)
}
@@ -484,7 +484,7 @@ func (c *scpCommand) handleDownload(filePath string) error {
baseTransfer := common.NewBaseTransfer(file, c.connection.BaseConnection, cancelFn, p, filePath,
common.TransferDownload, 0, 0, false)
t := newTranfer(baseTransfer, nil, r, 0)
t := newTransfer(baseTransfer, nil, r, 0)
err = c.sendDownloadFileData(p, stat, t)
// we need to call Close anyway and return close error if any and