[PLUG] FTP-response clarification
John Meissen
john at meissen.org
Wed May 6 20:40:32 UTC 2015
isaacem at gmail.com said:
> However the support team of our DLP software claiming that it is NOT standard
> response and the "standard" response should follow this format
> "220-Filezilla Server"
> More specifically the "-" missing, causing our issue for not detecting FTP
> response correctly.
> Anyone with FTP guidance?
RFC959 states:
A reply is defined to contain the 3-digit code, followed by Space
<SP>, followed by one line of text (where some maximum line length
has been specified), and terminated by the Telnet end-of-line
code. There will be cases however, where the text is longer than
a single line. In these cases the complete text must be bracketed
so the User-process knows when it may stop reading the reply (i.e.
stop processing input on the control connection) and go do other
things. This requires a special format on the first line to
indicate that more than one line is coming, and another on the
last line to designate it as the last. At least one of these must
contain the appropriate reply code to indicate the state of the
transaction. To satisfy all factions, it was decided that both
the first and last line codes should be the same.
Thus the format for multi-line replies is that the first line
will begin with the exact required reply code, followed
immediately by a Hyphen, "-" (also known as Minus), followed by
text. The last line will begin with the same code, followed
immediately by Space <SP>, optionally some text, and the Telnet
end-of-line code.
For example:
123-First line
Second line
234 A line beginning with numbers
123 The last line
The user-process then simply needs to search for the second
occurrence of the same reply code, followed by <SP> (Space), at
the beginning of a line, and ignore all intermediary lines. If
an intermediary line begins with a 3-digit number, the Server
must pad the front to avoid confusion.
So to summarize, the "standard" response is a number followed by a space,
unless the response is multi-line, in which case it's number followed by '-'
(hyphen).
More information about the PLUG
mailing list