Class: Ftpd::FtpServer

Inherits:
TlsServer show all
Defined in:
lib/ftpd/ftp_server.rb

Instance Attribute Summary collapse

Attributes inherited from TlsServer

#certfile_path, #tls

Attributes inherited from Server

#interface, #port

Instance Method Summary collapse

Methods inherited from Server

#bound_port, #start, #stop

Constructor Details

#initialize(driver) ⇒ FtpServer

Create a new FTP server. The server won’t start until the #start method is called.

The driver should expose these public methods:

Parameters:

  • driver

    A driver for the server’s dynamic behavior such as authentication and file system access.



52
53
54
55
56
57
58
59
60
# File 'lib/ftpd/ftp_server.rb', line 52

def initialize(driver)
  super()
  @driver = driver
  @debug_path = '/dev/stdout'
  @debug = false
  @response_delay = 0
  @list_formatter = ListFormat::Ls
  @auth_level = AUTH_PASSWORD
end

Instance Attribute Details

#auth_levelInteger

One of:

  • Ftpd::AUTH_USER

  • Ftpd::AUTH_PASSWORD (default)

  • Ftpd::AUTH_ACCOUNT

Returns:

  • (Integer)

    The authentication level



40
41
42
# File 'lib/ftpd/ftp_server.rb', line 40

def auth_level
  @auth_level
end

#debugObject

If truthy, emit debug information (such as replies received and responses sent) to the file named by #debug_path.

Change to this attribute only take effect for new sessions.



11
12
13
# File 'lib/ftpd/ftp_server.rb', line 11

def debug
  @debug
end

#debug_pathObject

The path to which to write debug information. Defaults to ‘/dev/stdout’

Change to this attribute only take effect for new sessions.



18
19
20
# File 'lib/ftpd/ftp_server.rb', line 18

def debug_path
  @debug_path
end

#list_formatterObject

The class for formatting for LIST output. Defaults to ListFormat::Ls. Changes to this attribute only take effect for new sessions.



32
33
34
# File 'lib/ftpd/ftp_server.rb', line 32

def list_formatter
  @list_formatter
end

#response_delayObject

The number of seconds to delay before replying. This is for testing, when you need to test, for example, client timeouts. Defaults to 0 (no delay).

Change to this attribute only take effect for new sessions.



26
27
28
# File 'lib/ftpd/ftp_server.rb', line 26

def response_delay
  @response_delay
end