Class: Ftpd::Telnet
Overview
Handle the limited processing of Telnet sequences required by the FTP RFCs.
Telnet option processing is quite complex, but we need do only a simple subset of it, since we can disagree with any request by the client to turn on an option (RFC-1123 4.1.2.12). Adhering to RFC-1143 (“The Q Method of Implementing TELNET Option Negiation”), and supporting only what’s needed to keep all options turned off:
-
Reply to WILL sequence with DONT sequence
-
Reply to DO sequence with WONT sequence
-
Ignore WONT sequence
-
Ignore DONT sequence
We also handle the “interrupt process” and “data mark” sequences, which the client sends before the ABORT command, by ignoring them.
All Telnet sequence start with an IAC, followed by at least one character. Here are the sequences we care about:
SEQUENCE CODES
----------------- --------------------
WILL IAC WILL option-code
WONT IAC WONT option-code
DO IAC DO option-code
DONT IAC DONT option-code
escaped 255 IAC IAC
interrupt process IAC IP
data mark IAC DM
Any pathalogical sequence (e.g. IAC + x01), or any sequence we don’t recognize, we pass through.
Defined Under Namespace
Modules: Codes
Constant Summary
Constants included from Codes
Codes::DM, Codes::DO, Codes::DONT, Codes::IAC, Codes::IP, Codes::WILL, Codes::WONT
Instance Attribute Summary collapse
-
#plain ⇒ Object
readonly
The command with recognized Telnet sequences removed.
-
#reply ⇒ Object
readonly
Any Telnet sequences to send.
Instance Method Summary collapse
-
#initialize(command) ⇒ Telnet
constructor
Create a new instance with a command that may contain Telnet sequences.
Constructor Details
#initialize(command) ⇒ Telnet
Create a new instance with a command that may contain Telnet sequences.
53 54 55 |
# File 'lib/ftpd/telnet.rb', line 53 def initialize(command) parse_command command end |
Instance Attribute Details
#plain ⇒ Object (readonly)
The command with recognized Telnet sequences removed
43 44 45 |
# File 'lib/ftpd/telnet.rb', line 43 def plain @plain end |
#reply ⇒ Object (readonly)
Any Telnet sequences to send
47 48 49 |
# File 'lib/ftpd/telnet.rb', line 47 def reply @reply end |