TIdGopherServer
Implements a Gopher server.
Unit
Description
The TIdGopherServer is a server implementation of the Internet Gopher protocol (RFC 1436) as described in the Internet Standards document:
- RFC 1436 - The Internet Gopher Protocol (http://www.rfc-editor.org/rfc/rfc1436.txt)
TIdGopherServer also implements partial support for the Gopher+ protocol as described in the document:
- Gopher+, Upward-Compatible Enhancements to the Internet Gopher protocol (http://boombox.micro.umn.edu/pub/gopher/gopher_protocol/Gopher+/Gopher+.txt)
Gopher is a distributed document system developed at the University of Minnesota as an attempt to make locating information resources intuitive for users through a series of structured menus leading to documents or pointers to other protocols such as Telnet and TN3270. While this has been succeeded by the World Wide Web, this is still useful for accessing legacy systems and has a low overhead due to its simplicity and structure.
E-Mail address of the Gopher server maintainer.
property AdminEmail: String;
Description
AdminEmail is a String property that identifies the name and/or email address for the maintainer of the Gopher server. For example:
<admin@mygopher.com>
Admin <admin@mygopher.com>
Maximum length of a Gopher menu item.
property TruncateLength: Integer;
Description
TruncateLength is an Integer property that identifies the maximum length of the display text for a Gopher menu item.
Indicates that display text can be truncated.
property TruncateUserFriendlyName: Boolean;
Description
TruncateUserFriendlyName is a Boolean property that indicates if the display text for a Gopher menu item can be truncated to the length in
TruncateLength.
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create relies on the inherited Create method, and sets DefaultPort to the standard Gopher port (
IdPORT_GOPHER).
The application must set the AdminEmail property to a valid e-mail address for the administrator of the server.
Formats a Gopher menu item for display.
function ReturnGopherItem(ItemType: Char; UserFriendlyName: String; RealResourceName: String; HostServer: String; HostPort: Integer): String;
Parameters
ItemType: Char
UserFriendlyName: String
Display name for the menu item.
RealResourceName: String
Item selector or TN3270 hint.
HostServer: String
The server hosting the Gopher menu item.
HostPort: Integer
The port number for the Gopher server.
Return Value
String - Display values for the Gopher menu item.
Description
ReturnGopherItem is a String function that returns a properly formatted Gopher menu item provided with the information from the parameters.
ItemType should be one of the following constants defined in GopherConsts.
Send a Gopher menu item to the client.
procedure SendDirectoryEntry(Thread: TIdPeerThread; ItemType: Char; UserFriendlyName: String; RealResourceName: String; HostServer: String; HostPort: Integer);
Parameters
Thread: TIdPeerThread
The client connection to receive the Gopher item.
ItemType: Char
The Gopher item type constant.
UserFriendlyName: String
Name to display on client menus.
RealResourceName: String
Item selector or a hint for logging into a Telnet or TN3270 service.
HostServer: String
Gopher Server hosting the item.
HostPort: Integer
Port number for the host.
Description
SendDirectoryEntry is a procedure used to
send a Gopher menu item to the client connection specified in AThread.
ItemType contains a constant that identifies the item type, as defined in GopherConsts.pas, and normally contains of the following values:
procedure SetTruncateLength(length: Integer);
Description
SetTruncateLength is a procedure that provides write acess to the
TruncateLength property, and updates the maximum length of a Gopher menu item line.
Write method for the UserFriendlyName property.
procedure SetTruncateUserFriendlyName(truncate: Boolean);
Description
SetTruncateUserFriendlyName is a procedure that provides write access to the
TruncateUserFriendlyName property, and updates the value for the property.
Server event handler for a Gopher+ request.
Parameters
APlusData
The Gopher+ command and additional information for the request.
ARequest
The Gopher selector for the requested item.
AThread
Client connection making the request.
Description
OnPlusRequest is a
TPlusRequestEvent event handler that allows the server application to respond to Gopher+ requests.
APlusData can includes the Gopher+ command in the first byte and additional information such as a requested View for an item and sometimes ASK block data sent from the client.
The command byte in APlusData can be one of the following:
Server event handler for Gopher requests.
Parameters
ARequest
The Gopher selector from the client.
AThread
The client connection making the request.
Description
OnRequest is a
TRequestEvent event handler that allows the server application to respond to Gopher requests from the client connection in AThread.
ARequest is the selector read from the client connection.