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:

# Return truthy if the user/password should be allowed to
# log in.
authenticate(user, password)

# Return the file system to use for a user.  The file system
# should expose the same public methods as
# Ftpd::DiskFileSystem.
def file_system(user)

Parameters:

  • driver

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



45
46
47
48
49
50
51
# File 'lib/ftpd/ftp_server.rb', line 45

def initialize(driver)
  super()
  @driver = driver
  @debug_path = '/dev/stdout'
  @debug = false
  @response_delay = 0
end

Instance Attribute Details

#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

#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