Commit Graph

128 Commits

Author SHA1 Message Date
Julien Laffaye
64cacdb711 Fix issues reported by shadow 2021-03-06 19:43:28 -05:00
Julien Laffaye
05cd33e2ad Fix issues reported by errcheck 2021-03-06 19:36:26 -05:00
Julien Laffaye
c3c8c7ac65
Merge pull request #219 from ivandeex/master
trim trailing whitespace from the list commands
2021-03-02 14:57:56 -05:00
Nick Craig-Wood
a4e9650823 Fix STOR of zero length files to ProFTPd with TLS
Before this change, uploading a zero length file via TLS meant that
the tls.Handshake function was never called.

ProFTPd quite properly refuses to accept an empty TCP connection with
no TLS handshake as a zero length upload and gives the error

    425 Unable to build data connection: Operation not

See: https://forum.rclone.org/t/rclone-ftps-explicit-rclone-touch-empty-files-proftpd-unable-to-build-data-connection-operation-not-permitted/22522
2021-03-01 16:01:20 +00:00
Ivan Andreev
24897db640 Trim trailing whitespace from list commands
Listing a current directory (when the path argument is empty)
would send the command "LIST " with trailing whitespace to FTP
resulting in 500 errors with Solaris FTP server.
This patch fixes that.
2021-02-14 19:48:19 +03:00
Nick Craig-Wood
624bcac8b4 Add a DialWithDisabledMLSD option to ignore MLSD if advertised
This is useful for servers which advertise MLSD (eg some versions of
Serv-U) but don't support it properly.
2020-11-05 11:42:34 +00:00
Mathias Fredriksson
744ff9c18a
Remove naked returns 2020-10-20 20:51:56 +03:00
Nick Craig-Wood
fcad893ae7 Implement PRET command for distributed ftp servers, eg drftpd
See: https://tools.ietf.org/html/draft-dd-pret-00

Fixes #197
2020-10-19 17:59:40 +01:00
Julien Laffaye
43afc84ae3
Merge pull request #199 from ncw/fix-198
Fix Stor() no longer reporting errors from the io.Reader passed in
2020-10-19 10:04:29 -04:00
Nick Craig-Wood
9f5200151c Delay FEAT command until after Login - fixes #200
Some servers require the user to be logged in to run FEAT

    ftp://serverftp:2121: Connecting to FTP server
    FTP Rx: "220 DrFTPD+ 2.0 (+STABLE+) $Revision: 1949 $ http://drftpd.org"
    FTP Tx: "AUTH TLS"
    FTP Rx: "234 AUTH TLS successful"
    FTP Tx: "FEAT"
    FTP Rx: "530 Not logged in."
2020-09-12 11:30:42 +01:00
Nick Craig-Wood
c0343a706b Fix Stor() no longer reporting errors from the io.Reader passed in
This commit

4a68979b89 always return the ReadResponse error after an upload

Broke the error return from Stor().  If you attempt to upload a file
with Stor() and the io.Reader that you passed in returns an error,
this was not returned by the Stor() command leading the user to think
the file was uploaded correctly.

This was detected by rclone's unit tests and the exact commit was
pinpointed with git commit.

This commit fixes it by returning the error from io.Copy or the error
from ReadResponse - the latter if they are both set.

Fixes #198
2020-09-11 17:14:05 +01:00
Julien Laffaye
39e3779af0
Merge pull request #192 from drakkan/resp_error
try to read the server response after a failed upload
2020-08-12 10:35:50 -04:00
Nicola Murino
4a68979b89 always return the ReadResponse error after an upload 2020-08-06 16:44:05 +02:00
Julien Laffaye
c2ee4fa250
Merge pull request #178 from crazy-max/optional-utf8
Make "OPTS UTF8 ON" optional
2020-07-30 09:57:23 -04:00
Nicola Murino
08a1e2e380 try to read the server response after a failed upload
if the upload failed we still need to try to read the server
response otherwise if the failure is not due to a connection problem,
for example the server denied the upload for quota limits, we miss
the response and we cannot use the connection to send other commands

Here is what happen before this patch:

C->S STOR test_file1.dat
S->C 150 Using transfer connection
S->C 550 Could not transfer file: denying write due to space limit

the client does not read the above 550 response and send the next command, so
the response for the STOR response will be readed as response for the next
command
2020-07-30 14:55:31 +02:00
CrazyMax
696d865fa3
Opt-out 2020-07-28 21:13:33 +02:00
Julien Laffaye
e31b4effea
Merge pull request #188 from Techassi/typeentry-string
EntryType String() function
2020-07-28 13:54:05 -04:00
Nick Craig-Wood
6563ce9dff Workaround pure-ftpd connections failing with "Unknown command"
pure-ftpd 1.0.49-4 as supplied as part of Ubuntu 20.04 advertises UTF8
support in the FEAT command but the OPTS command fails to turn it on.

    OPTS UTF8 ON
    504 Unknown command

This patch introduces a workaround to ignore the error which enables
this library to work with this version of pure-ftpd. Filezilla appears
to ignore this error in a similar way.
2020-07-18 14:21:12 +01:00
Techassi
3e3979ddc6
Add String() function 2020-07-17 18:01:41 +02:00
CrazyMax
01c291065f
Move func 2020-05-05 21:04:03 +02:00
CrazyMax
60012218fd
Make "OPTS UTF8 ON" optional (#172) 2020-05-05 13:04:49 +02:00
Viorel Craescu
3b6697e5b6 fix_walk 2020-04-26 10:28:15 +03:00
Julien Laffaye
b9f3ade291 Merge branch 'master' of github.com:jlaffaye/ftp 2020-04-23 00:49:57 +02:00
Julien Laffaye
ac1574d383 Add DialWithExplicitTLS 2020-04-23 00:49:43 +02:00
Julien Laffaye
59f85871cf
Merge pull request #169 from flowrean/append-cmd
Add support for FTP append (APPE) command
2020-04-22 18:29:36 -04:00
Julien Laffaye
041eae9a3d
Merge pull request #141 from johnepiscopo/add-walk
Adds the ability to walk through a directory tree
2020-03-13 11:03:37 -04:00
Florian Goetghebeur
827e50c0bd Add support for append (APPE) command 2020-03-10 11:43:17 +01:00
Julien Laffaye
7cd8b0bcf3 Fix spelling errors 2019-07-21 21:44:32 +02:00
Julien Laffaye
1c9975e197 gofmt 2019-07-21 21:36:15 +02:00
Julian Kornberger
c1312a7102 Correctly parse symlink (#152)
fixes #151
2019-06-24 10:48:59 +02:00
Gary Kim
8f5b34ce00 Complete Implicit FTPS support (#143)
feat: complete implicit ftps support
2019-05-19 22:39:11 +02:00
John Episcopo
e6e290ca7f Added initial logic and tests for the Walker 2019-05-01 17:00:01 +01:00
Alexander Pevzner
6a014d5e22 Add DialWithDialFunc to specify dial function used for both control and data connections (#140)
Add DialWithDialFunc to specify dial function used for both control and data connections

If used DialWithNetConn, DialWithNetConn takes precedence for
the control connection, while data connections will be established
using function specified with the DialWithDialFunc option
2019-04-27 18:36:46 +02:00
Julien Laffaye
e6de3d35bf Replace DialWithOptions with Dial
No need for a dedicated function as Dial can take no options.
2019-04-23 14:04:25 +02:00
Julien Laffaye
8b7b512afb Add DialWithDebugOutput to log commands. 2019-04-17 13:16:26 +02:00
Julien Laffaye
52d3001130 Specify that a server conn is not concurrent safe.
Fixes #128
2019-04-11 17:57:07 +02:00
Julien Laffaye
04b1878733 Add DialWithOptions
DialWithOptions accept a variadic number of options, allowing to
introduce more options in the fure without breaking the API.
2019-04-10 20:25:16 +02:00
Julien Laffaye
f75dead520 error strings should not be capitalized (ST1005) 2019-01-22 14:50:39 +01:00
Julien Laffaye
509a294b60 Add missing error check in RemoveDirRecur 2019-01-22 14:47:31 +01:00
Vladimir Buyanov
3f6433f7ea Workaround for FTP servers, that does not support UTF8 option. (#120)
* Workaround for FTP servers, that does not support UTF8 option.
2018-08-08 23:16:05 +02:00
Shannon Wynter
4772add9d0 Make it possible to specify what timezone to parse timestamps in 2018-03-20 15:07:44 +10:00
Nick Craig-Wood
8aeb589fce Parse IP address returned with PASV to fix load balanced FTP servers
Fixes #114
2018-02-04 16:02:56 +00:00
Julien Laffaye
83891dbe00
Merge pull request #110 from digineo/time-parsing
Fix time parsing and reduce syscalls
2018-01-05 08:56:08 +01:00
Julian Kornberger
38ce06637b Fix golint warning 2018-01-04 15:23:55 +01:00
Julian Kornberger
352a1d8821 Fix time parsing and reduce syscalls
closes #109
2018-01-04 13:28:55 +01:00
Julian Kornberger
f5cdbb9f1e Use net.TCPAddr to extract remote IP address 2017-08-12 01:24:47 +02:00
Joe
479d87b91a added recursively deleting folders
added tests for recursive delete

added change dir to fix test + refactor

fixed path issues

changes directory now instead of deleting by path

proftpd fix

added file edge case + more tests

added directory does not exist test

added correct directory after delete test

fixed correct directory test

renamed test directories + files

missed a renamed
2017-06-13 21:21:50 +01:00
Davide D'Agostino
980e2e09a5 Document that closing two times doesn't do anything 2017-05-04 19:03:56 -07:00
Davide D'Agostino
cb362c4101 Rename connClosed -> closed 2017-05-04 17:46:41 -07:00
Davide D'Agostino
7e3820b35d Address comments 2017-05-04 13:03:00 -07:00