TROAsyncHTTPServer

Overview

The TROAsyncHTTPServer represents an asynchronous HTTP server which is used as public server property in the TROHTTPServer server channel and internally in the TROSuperHTTPServer server channel.

Location

  • Unit: uROAsyncHttpServer.pas

 

constructor Create

Creates a new instance with the following default values of these properties: - MaxPostData - 10MB - 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

Gets or sets the flag indicating whether the server should listen for IPv4 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true).

property BindV4: Boolean read write

BindV6

Gets or sets the flag indicating whether the server should listen for IPv6 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true).

property BindV6: Boolean read write

DisableNagle

Controls whether data packets are sent individually or if small packets are held back to send as part of fewer larger data packets. Normally, you will want this disabled as it can have a significant effect on performance. The only time when its worth keeping the property enabled is when there are many small packets to be sent and you need to keep network bandwidth to a minimum.

See more at Nagle's algorithm

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

ListenQueue

Size of listen queue, by default = 15.

property ListenQueue: Cardinal read write

MaxHeaderLines

Determines the maximum HTTP header count allowed. By default, this property equals 64.

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 10MB.

property MaxPostData: Integer read write

OnBeforeCleanupContext

Occurs before the current context is cleaned up.

property OnBeforeCleanupContext: TROAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeCleanupContext(Sender: TObject; aContext: IROAsyncContext)

OnBeforeData

Occurs before request data is fetched.

property OnBeforeData: TROAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeData(Sender: TObject; aContext: IROAsyncContext)

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: TROAsyncHTTPRequestHandler read write
delegate: procedure OnRequest(Sender: TObject; aContext: IROAsyncContext)

OnResponseFailed

Occurs when a response failed.

property OnResponseFailed: TROAsyncHTTPRequestHandler read write
delegate: procedure OnResponseFailed(Sender: TObject; aContext: IROAsyncContext)

OnResponseSent

Occurs when a response is send to the client.

property OnResponseSent: TROAsyncHTTPRequestHandler read write
delegate: procedure OnResponseSent(Sender: TObject; aContext: IROAsyncContext)

OpenSSL

Specifies SSL properties

property OpenSSL: TROOpenSSL read

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: TROAsyncSocket read

Socket6

The network socket for IPv6 network addresses.

property Socket6: TROAsyncSocket read

 

Active

Represents the active state of the current server.

property Active: Boolean read write

BindV4

Gets or sets the flag indicating whether the server should listen for IPv4 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true).

property BindV4: Boolean read write

BindV6

Gets or sets the flag indicating whether the server should listen for IPv6 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true).

property BindV6: Boolean read write

DisableNagle

Controls whether data packets are sent individually or if small packets are held back to send as part of fewer larger data packets. Normally, you will want this disabled as it can have a significant effect on performance. The only time when its worth keeping the property enabled is when there are many small packets to be sent and you need to keep network bandwidth to a minimum.

See more at Nagle's algorithm

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

ListenQueue

Size of listen queue, by default = 15.

property ListenQueue: Cardinal read write

MaxHeaderLines

Determines the maximum HTTP header count allowed. By default, this property equals 64.

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 10MB.

property MaxPostData: Integer read write

OpenSSL

Specifies SSL properties

property OpenSSL: TROOpenSSL read

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: TROAsyncSocket read

Socket6

The network socket for IPv6 network addresses.

property Socket6: TROAsyncSocket read

 

constructor Create

Creates a new instance with the following default values of these properties: - MaxPostData - 10MB - 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: TROAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeCleanupContext(Sender: TObject; aContext: IROAsyncContext)

OnBeforeData

Occurs before request data is fetched.

property OnBeforeData: TROAsyncHTTPRequestHandler read write
delegate: procedure OnBeforeData(Sender: TObject; aContext: IROAsyncContext)

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: TROAsyncHTTPRequestHandler read write
delegate: procedure OnRequest(Sender: TObject; aContext: IROAsyncContext)

OnResponseFailed

Occurs when a response failed.

property OnResponseFailed: TROAsyncHTTPRequestHandler read write
delegate: procedure OnResponseFailed(Sender: TObject; aContext: IROAsyncContext)

OnResponseSent

Occurs when a response is send to the client.

property OnResponseSent: TROAsyncHTTPRequestHandler read write
delegate: procedure OnResponseSent(Sender: TObject; aContext: IROAsyncContext)