Commit Graph

47 Commits

Author SHA1 Message Date
Øyvind Heddeland Instefjord
99be0634ab
Add forceListHidden dial option to force the use of 'LIST -a' command (#271)
This is useful for servers that do not offer up
hidden folders/files by default when using LIST/MLSD
commands.
Setting forceListHidden to true will force the use of
the 'LIST -a' command even when MLST support has
been detected.
2022-09-04 14:43:06 -04:00
Thomas Hallgren
0aeb8660a7
Add MLST command in the form of a Get method (#269)
* Add MLST command in the form of a Get method

The `LIST` and `MLSD` commands are inefficient when the objective
is to retrieve one single `Entry` for a known path, because the only way
to get such an entry is to list the parent directory using a data
connection. The `MLST` fixes this by allowing one single `Entry` to be
returned using the control connection.

The name `Get` was chosen because it is often used in conjunction with
`List` as a mean to get one single entry.

Signed-off-by: Thomas Hallgren <thomas@datawire.io>

* Changes in response to code review:

- Rename `Get` to `GetEntry` (because it returns an `*Entry`)
- Add test-case for multiline response on the control connection
- Fix issues with parsing the multiline response.

Signed-off-by: Thomas Hallgren <thomas@datawire.io>

* Add sample output from MLST to GetEntry comment.

Signed-off-by: Thomas Hallgren <thomas@datawire.io>

* Changes in response to code review:

- Remove unused `time.Time` argument
- Add struct labels to make `govet` happy

Signed-off-by: Thomas Hallgren <thomas@datawire.io>

* Remove time arg when calling parseNextRFC3659ListLine

Signed-off-by: Thomas Hallgren <thomas@datawire.io>

Signed-off-by: Thomas Hallgren <thomas@datawire.io>
2022-08-21 17:25:29 -04:00
Julien Laffaye
5a2fd50da8
ioutil is deprecated, use io package instead 2022-08-18 11:18:54 -04:00
Julien Laffaye
45482d097e
Use assert package to simplify tests 2022-08-17 19:24:40 -04:00
Julien Laffaye
813c8a8384 Add test for DialWithDialer 2022-03-08 20:25:35 -05:00
Julien Laffaye
a8377c07ac Add test for DialWithDialFunc 2022-03-08 19:06:48 -05:00
Julien Laffaye
30e028f001 Check errors in tests/mocks 2022-03-08 18:35:30 -05:00
Ivan Andreev
90b220bedb Add time commands, related options, state getters and unit tests 2021-10-30 00:10:15 +03:00
Julien Laffaye
64cacdb711 Fix issues reported by shadow 2021-03-06 19:43:28 -05: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
Julien Laffaye
0de5c29d45 Fix issues reported by staticcheck 2020-10-21 22:10:46 +02:00
Florian Goetghebeur
827e50c0bd Add support for append (APPE) command 2020-03-10 11:43:17 +01: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
55546487cf Use mock for all tests 2019-04-10 20:20:50 +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
cb362c4101 Rename connClosed -> closed 2017-05-04 17:46:41 -07:00
Julian Kornberger
569481fc3b Add SetDeadline to Response
closes #70
2017-04-15 12:18:04 +02:00
Julien Laffaye
68918a8852 Remove useless assignment 2017-03-04 12:58:20 +01:00
Vahid Sohrabloo
7e0dbe8c48 Add more test in FileSize 2017-02-20 09:04:20 +03:30
Vahid Sohrabloo
468423d44a Change file Size type from int to int64 and add test for it 2017-02-20 00:13:08 +03:30
Julien Laffaye
de604c9776 Expose disableEPSV
Fixes #71
2017-02-05 21:02:16 +01:00
Julien Laffaye
988909ab28 Disable EPSV for tests.
Also disable it for next attempts when it failed.
2016-11-24 14:49:16 +01:00
Julian Kornberger
ff557cea69 Create mock for multiline test
This removes the dependency to ftp.mozilla.org
2015-08-29 15:26:40 +02:00
Julien Laffaye
7acded32b2 Add a test for the legacy Connect function. 2015-08-21 18:47:44 +02:00
Julien Laffaye
d640995c66 Add tests for timeout and wrong login. 2015-08-21 18:36:56 +02:00
Julien Laffaye
7534ffcb97 Add a test for RetrFrom method. 2015-08-20 22:47:09 +02:00
Julian Kornberger
6f8509b5d6 Increase test coverage 2015-08-20 10:37:56 +02:00
Julian Kornberger
5bb86ee66f Test PASV as well 2015-08-20 01:51:00 +02:00
Julien Laffaye
519b366223 Silence StatusNotImplemented error for Logout() 2015-08-19 00:17:44 +02:00
Julian Kornberger
dd7e903125 Use localhost to test IPv6 connectivity 2015-08-18 22:58:00 +02:00
Julian Kornberger
77206a0866 Add Travis CI 2015-08-18 20:56:31 +02:00
Julien Laffaye
0ae5d598fa Use prefered API function. 2015-08-18 19:03:26 +02:00
Julien Laffaye
3e21d70d53 Skip TestConnIPv6 in short mode. 2015-08-18 19:02:23 +02:00
Julien Laffaye
a6e47bb27d Merge branch 'ipv6' of https://github.com/stacktic/ftp into stacktic-ipv6
Conflicts:
	ftp.go
2015-08-18 18:52:29 +02:00
Julien Laffaye
110a39bff4 Skip functional testing in short mode. 2015-08-18 18:39:31 +02:00
Julien Laffaye
a9410e3e51 Implements timeouts.
Added DialTimeout and Dial functions.
Fixes issue #27.
2015-03-16 23:45:56 +01:00
Arnaud Ysmal
691fac98af Force EPSV for IPv6 hosts and fix split of IPv6:port 2013-12-04 23:57:46 +01:00
SunRunAway
2a6b9c2640 Merge remote-tracking branch 'upstream/master' into feature/fix_ReadCodeLine 2013-07-10 18:20:42 +08:00
SunRunAway
65a25a2848 do ReadCodeLine in Close() @ ReadCloser 2013-07-10 18:18:32 +08:00
Julien Laffaye
60693cc590 Add a comment to state why TestConn2 is interesting. 2013-07-08 08:44:16 +02:00
SunRunAway
66a09f43d5 use ReadResponse @Connect 2013-07-08 13:48:11 +08:00
Julien Laffaye
91fc6ada34 Added Logout() method. 2013-05-19 21:15:23 +02:00
Julien Laffaye
acaf7edcbc gofmt 2013-02-17 10:31:56 +01:00
jlaffaye
6110501482 Added CurrentDir() and ChangeDirToParent()
Added more tests.
2011-09-07 16:52:52 +02:00
jlaffaye
6aaa275d08 Login() is a function on its own.
It allows to try multiple logins without closing the connection.
Drop the useless ConnectAnonymous.
2011-09-06 18:27:30 +02:00
jlaffaye
b70c76ed28 More commands and their tests.
Delete()
MakeDir()
RemoveDir()
2011-09-06 00:02:01 +02:00
jlaffaye
a87255661d Better error handling, new commands.
The code is no safer.
Added Stor(), Rename(), NoOp()
Improved Retr()
Added client tests (requires a ftp server on localhost)
2011-09-05 23:36:14 +02:00