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 - 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

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

Socket6

The network socket for IPv6 network addresses.

property Socket6: TIPBaseAsyncSocket 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

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

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

Socket6

The network socket for IPv6 network addresses.

property Socket6: TIPBaseAsyncSocket 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: 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)