Indy 9
|
TIdFTPServerThread = class(TIdPeerThread)
TIdFTPServerThread provides properties and methods that set or retrieve connection and transfer parameters for the FTP client connection. TIdFTPServerThread implements the inherited Connection property as the Control channel for the FTP client, and also specifies a TIdTCPConnection to be used as the DataChannel for FTP data transfer operations.
TIdFTPServerThread is used to access the Thread of execution in the TIdCommand reply handlers used in the FTP server implementation.
property ALLOSize: Integer;
property Authenticated: Boolean;
property CurrentDir: string;
property DataChannelThread: TIdDataChannelThread;
DataChannelThread allows the client connection to create and access either an active or a passive connection used for the data channel in the FTP client.
During execution, DataChannelThread uses the Data property to access the TStrings or TStream values used during the data transfer operation. After performing the transfer operation, the socket for the data channel in the thread is disconnected, and the Success or Error message is written using the control channel for the threaded client connection. The data channel thread is stopped after execution of the transfer operation.
DataChannelThread exists for the lifetime of the threaded client connection. It is initalized and started prior to data transfer operations, and suspended when the data transfer operation is completed.
property DataMode: TIdFTPTransferMode;
property DataPort: Integer;
property DataStruct: TIdFTPDataStructure;
property DataType: TIdFTPTransferType;
DataType is updated when the command reply handler is executed for the FTP TYPE command.
property HomeDir: string;
property Password: string;
When Username contains the value "anonymous" or "guest", the AccessLevel for the client connection is set to idaAnonymousUser. Otherwise, UserAccounts on the FTP server are used to perform account authorization and determine the AccessLevel for the account.
property PASV: Boolean;
PASV is read in the RETR command reply handler to determine if the DataChannel should Connect (when Passive is False) or Listen for the client connection (when Passive is True) prior to transferring FTP data.
property RESTPos: Integer;
RESTPos is updated in the command reply handler for the REST command for an Authenticated FTP client connection. The default value for RESTPos is 0. RESTPos is read in the command reply handler for the RETR command, and the FTP Data stream is moved to the indicated position prior to beginning the transfer operation on the DataChannel.
property Username: string;
When Username contains the value "anonymous" or "guest", the AccessLevel for the client connection is set to idaAnonymousUser. Otherwise, UserAccounts on the FTP server are used to perform account authorization and determine the AccessLevel for the account.
property UserType: TIdFTPUserType;
UserType will be given the value utAnonymousUser when AllowAnonymousLogin is True, and AnonymousAccounts contains the account identitity provided as a parameter to the command event handler. Username is given the value in the parameter to the command event handler.
If AllowAnonymousLogin is False or the account identity is not present in AnonymousAccounts, UserType is assigned the value utNormalUser and Username is given the contents of the parameter for the FTP USER command.
UserType will contain the value utNone when an account identity is not provided.
UserType is subsequently used when the FTP PASS command verb is received from the client connection, and the account must be authorized using the credentials provided for the user account. UserType will control the authorization mechanism used for the threaded client connection.
When UserType contains the value utAnonymousUser, the server implementation will require that the password for an anonymous account contain a valid email address when TIdFTPServer.AnonymousPassStrictCheck is True. Otherwise the anonymous account must provide a non-blank password containing any value. When these condition are met, Authenticated will contain True and the parameter value for the command event handler is assigned to the Password property. If either condition is not met, UserType will revert to the value utNone and Authenticated will contain False.
When UserType contains the value utNormalUser, the server implementation will authenticate using the account information in TIdFTPServer.UserAccounts when assigned. The UserAccounts collection is used to perform TIdUserAccounts.AuthenticateUser for the account identity and credentials specified in the Username and Password properties. Authenticated will indicate the results of the authorization process.
Use TIdFTPServer.OnUserLogin to perform account authentication when TIdAccount object instance are not used in the server implementation. Use TIdFTPServer.OnAfterUserLogin to perform additional logging or to extend the authorization process for the threaded client connection.
The default value for UserType is utNone, as assigned in the Create constructor.
constructor Create(ACreateSuspended: Boolean = True; const ADefaultDataPort: Integer = IdPORT_FTP_DATA); reintroduce;
destructor Destroy; override;