Some behind-firewall-and-corporate-network FTP servers
responds their private-net address instead of the
publicly reachable.
This fix checks for such address and uses the
command channel's address instead.
Some servers seem to send a blank line at the end of an MLST response.
MLST Download
250-
Size=53248;Modify=20230327134339.000;Type=dir; Download
250 Requested file action okay, completed.
Before this change this would cause the GetEntry method to return this
error.
unsupported LIST line
This patch ignores blank lines in the MLST response.
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.
* 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>
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.
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."
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
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
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.