TIPAsyncHTTPServer

Overview

The TIPAsyncHTTPServer represents an asynchronous HTTP server which is used as public server property in the TROIpHTTPServer server channel and internally in the TROIpSuperHTTPServer server channel.

You can use this class directly if you want to hook a custom TIPAsyncHTTPServer object with the TROIpHTTPServer server channel.

Location

  • Unit: uIPAsyncHttpServer.pas

 

constructor Create

Creates a new instance with the following default values of these properties: MaxPostData - 2MB, MaxHeaderLines - 64, BindV6 - false, BindV4 - true, DisableNagle - true, Port - 80, IdleTimeout - 180.

constructor Create

Active

Represents the active state of the current server.

property Active: Boolean read write

BindV4

Determines whether it is allowed to use IPv4 network addresses.

property BindV4: Boolean read write

BindV6

Determines whether it is allowed to use IPv6 network addresses.

property BindV6: Boolean read write

DisableNagle

property DisableNagle: Boolean read write

IdleTimeout

Determines the admissible interval in seconds between send or receive operations.

property IdleTimeout: integer read write

KeepAlive

Controls whether to use HTTP Keep-Alive to keep the connection alive between requests.
If enabled (true) , once a request is made and a connection is established, this connection is kept open and used for future requests.
If disabled, the connection is closed, and a new connection is created for future requests.
Since establishing a connection is - relatively speaking - a costly and resource intensive operation for the network, compared to sending small amounts of data, it is recommended to keep this option enabled for optimal performance, if requests to the server are done relatively frequently.
For Keep-Alive to work, the option must be supported and enabled on both client and server.

property KeepAlive: boolean read write

MaxHeaderLines

Determines the maximum HTTP header count allowed.

property MaxHeaderLines: Integer read write

MaxPostData

Determines the maximum length of client's request data (checks the value of the request Content-Length header). By default, this property equals 2MB.

property MaxPostData: Integer read write

OnBeforeCleanupContext

Occurs before the current context is cleaned up.

property OnBeforeCleanupContext: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeCleanupContext(Sender: TObject; aContext: IIPAsyncContext)

OnBeforeData

Occurs before request data is fetched.

property OnBeforeData: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeData(Sender: TObject; aContext: IIPAsyncContext)

OnManualBind

Allows to customize the binding of the server to the host's IP addresses. By default the server is bound to all addresses available. When this event is handled by the user code no automatic binding is performed, the binding becomes user's responsibility.

property OnManualBind: TNotifyEvent read write

OnRequest

Occurs while processing an incoming client's request.

property OnRequest: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnRequest(Sender: TObject; aContext: IIPAsyncContext)

OnResponseFailed

Occurs when a response failed.

property OnResponseFailed: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnResponseFailed(Sender: TObject; aContext: IIPAsyncContext)

OnResponseSent

Occurs when a response is send to the client.

property OnResponseSent: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnResponseSent(Sender: TObject; aContext: IIPAsyncContext)

Port

The network socket where the server will be listening (port 80 by default).

property Port: Integer read write

Socket4

The network socket for IPv4 network addresses.

property Socket4: TIPBaseAsyncSocket read write

Socket6

The network socket for IPv6 network addresses.

property Socket6: TIPBaseAsyncSocket read write

 

Active

Represents the active state of the current server.

property Active: Boolean read write

BindV4

Determines whether it is allowed to use IPv4 network addresses.

property BindV4: Boolean read write

BindV6

Determines whether it is allowed to use IPv6 network addresses.

property BindV6: Boolean read write

DisableNagle

property DisableNagle: Boolean read write

IdleTimeout

Determines the admissible interval in seconds between send or receive operations.

property IdleTimeout: integer read write

KeepAlive

Controls whether to use HTTP Keep-Alive to keep the connection alive between requests.
If enabled (true) , once a request is made and a connection is established, this connection is kept open and used for future requests.
If disabled, the connection is closed, and a new connection is created for future requests.
Since establishing a connection is - relatively speaking - a costly and resource intensive operation for the network, compared to sending small amounts of data, it is recommended to keep this option enabled for optimal performance, if requests to the server are done relatively frequently.
For Keep-Alive to work, the option must be supported and enabled on both client and server.

property KeepAlive: boolean read write

MaxHeaderLines

Determines the maximum HTTP header count allowed.

property MaxHeaderLines: Integer read write

MaxPostData

Determines the maximum length of client's request data (checks the value of the request Content-Length header). By default, this property equals 2MB.

property MaxPostData: Integer read write

Port

The network socket where the server will be listening (port 80 by default).

property Port: Integer read write

Socket4

The network socket for IPv4 network addresses.

property Socket4: TIPBaseAsyncSocket read write

Socket6

The network socket for IPv6 network addresses.

property Socket6: TIPBaseAsyncSocket read write

 

constructor Create

Creates a new instance with the following default values of these properties: MaxPostData - 2MB, MaxHeaderLines - 64, BindV6 - false, BindV4 - true, DisableNagle - true, Port - 80, IdleTimeout - 180.

constructor Create

 

OnBeforeCleanupContext

Occurs before the current context is cleaned up.

property OnBeforeCleanupContext: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeCleanupContext(Sender: TObject; aContext: IIPAsyncContext)

OnBeforeData

Occurs before request data is fetched.

property OnBeforeData: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeData(Sender: TObject; aContext: IIPAsyncContext)

OnManualBind

Allows to customize the binding of the server to the host's IP addresses. By default the server is bound to all addresses available. When this event is handled by the user code no automatic binding is performed, the binding becomes user's responsibility.

property OnManualBind: TNotifyEvent read write

OnRequest

Occurs while processing an incoming client's request.

property OnRequest: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnRequest(Sender: TObject; aContext: IIPAsyncContext)

OnResponseFailed

Occurs when a response failed.

property OnResponseFailed: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnResponseFailed(Sender: TObject; aContext: IIPAsyncContext)

OnResponseSent

Occurs when a response is send to the client.

property OnResponseSent: TIPAsyncHTTPRequestHandler read write
delegate: procedure OnResponseSent(Sender: TObject; aContext: IIPAsyncContext)

See Also