HttpIncomingRequestResponse

Overview

Abstract base class representing an incoming HTTP message - either a request to received by the HttpServer, or a response received by the HttpClient. You will usually deal with the separate descendants HttpServerRequest or HttpClientResponse that descend from this class.

Location


 

constructor  protected    (declared in HttpRequestResponse)

 

constructor

 

HttpIncomingRequestResponse()

 

Sub New()

constructor (Connection, HttpHeaders)  protected

 

constructor(connection: Connection; headers: HttpHeaders)

 

HttpIncomingRequestResponse(Connection connection, HttpHeaders headers)

 

Sub New(connection As Connection, headers As HttpHeaders)

Parameters:

  • connection:
  • headers:

constructor (HttpHeaders)  protected    (declared in HttpRequestResponse)

 

constructor(header: HttpHeaders)

 

HttpIncomingRequestResponse(HttpHeaders header)

 

Sub New(header As HttpHeaders)

Parameters:

  • header:

Chunked

 

property Chunked: Boolean read;

 

Boolean Chunked { get; }

 

ReadOnly Property Chunked() As Boolean

Client  protected    (declared in HttpRequestResponse)

 

property Client: Boolean read;

 

Boolean Client { get; }

 

ReadOnly Property Client() As Boolean

CloneEvents    (declared in HttpRequestResponse)

 

method CloneEvents(source: HttpRequestResponse)

 

void CloneEvents(HttpRequestResponse source)

 

Sub CloneEvents(source As HttpRequestResponse)

Parameters:

  • source:

ContentBytes

Returns the HTTP body in form of a byte array.

Note that this method is not as efficient as the ContentStream method, as the entire body will be read into a memory buffer at once.

 

property ContentBytes: array of Byte read;

 

Byte[] ContentBytes { get; }

 

ReadOnly Property ContentBytes() As Byte()

ContentLength

Contains the ContentLength header value reveived from the remote side. If the remot did not provide a length (for example in HTTP 1.0 scenarios, or if Keep-Alive is not supported), accessing the property will raise an exception.

Use the HasContentLength property to determine if a valid ContentLength has been received.

 

property ContentLength: Int32 read;

 

Int32 ContentLength { get; }

 

ReadOnly Property ContentLength() As Int32

ContentStream

Returns a Stream object with the HTTP body of the received request (server) or response (client).

This object is a HttpIncomingStream, which provides direct access to the underling DataConnection, but is (at leats for HTTP 1.1) limited to the number of bytes indicated by the HTTP header. As such, the same limitations as for the Connection stream class apply, you can only rad it once and forward-only, and it does not support seeking or writing.

Because ContentStream provides you with direct access to the underlying Connection Stream, it is the fastest and most efficient way to access the response (as opposed to ContentString and ContentBytes, both of which involve copying the entire data from the stream into a memory buffer).

Note also, that you can easily use ContentStream to access and process even very large HTTP bodies (such as a huge file download), without the need to comy the entire body into memory, and without having to wait for the entire download to have finished before you can start processing it.

 

property ContentStream: Stream read;

 

Stream ContentStream { get; }

 

ReadOnly Property ContentStream() As Stream

ContentString

Returns the HTTP body in form of a String object.

Note that this method is the least efficient for accessing the HTTP body, as the entire body will first be read into a memory buffer (then accessible via ContentBytes), and then converted into a string by the assigned Encoding (Encoding.ASCII by default).

 

property ContentString: String read;

 

String ContentString { get; }

 

ReadOnly Property ContentString() As String

DataConnection

 

property DataConnection: Connection read;

 

Connection DataConnection { get; }

 

ReadOnly Property DataConnection() As Connection

Encoding    (declared in HttpRequestResponse)

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

FlushContent

 

method FlushContent: Boolean

 

Boolean FlushContent()

 

Function FlushContent() As Boolean

HasContentLength

Specifies whether the HTTP header provides a ContentLength field.

 

property HasContentLength: Boolean read;

 

Boolean HasContentLength { get; }

 

ReadOnly Property HasContentLength() As Boolean

HasOnTransferProgress  protected    (declared in HttpRequestResponse)

 

property HasOnTransferProgress: Boolean read;

 

Boolean HasOnTransferProgress { get; }

 

ReadOnly Property HasOnTransferProgress() As Boolean

 

property Header: HttpHeaders read write;

 

HttpHeaders Header { get; set; }

 

Property Header() As HttpHeaders

KeepAlive

 

property KeepAlive: Boolean read;

 

Boolean KeepAlive { get; }

 

ReadOnly Property KeepAlive() As Boolean

OnTransferEnd    (declared in HttpRequestResponse)

 

event OnTransferEnd: EventHandler<TransferEndEventArgs>;

 

delegate EventHandler<TransferEndEventArgs> OnTransferEnd()

 

Event OnTransferEnd As EventHandler<TransferEndEventArgs>

OnTransferProgress    (declared in HttpRequestResponse)

 

event OnTransferProgress: EventHandler<TransferProgressEventArgs>;

 

delegate EventHandler<TransferProgressEventArgs> OnTransferProgress()

 

Event OnTransferProgress As EventHandler<TransferProgressEventArgs>

OnTransferStart    (declared in HttpRequestResponse)

 

event OnTransferStart: EventHandler<TransferStartEventArgs>;

 

delegate EventHandler<TransferStartEventArgs> OnTransferStart()

 

Event OnTransferStart As EventHandler<TransferStartEventArgs>

Server  protected    (declared in HttpRequestResponse)

 

property Server: Boolean read;

 

Boolean Server { get; }

 

ReadOnly Property Server() As Boolean

TriggerOnTransferEnd  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferEnd(direction: TransferDirection)

 

void TriggerOnTransferEnd(TransferDirection direction)

 

Sub TriggerOnTransferEnd(direction As TransferDirection)

Parameters:

  • direction:

TriggerOnTransferProgress  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferProgress(direction: TransferDirection; position: Int64)

 

void TriggerOnTransferProgress(TransferDirection direction, Int64 position)

 

Sub TriggerOnTransferProgress(direction As TransferDirection, position As Int64)

Parameters:

  • direction:
  • position:

TriggerOnTransferStart  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferStart(direction: TransferDirection; size: Int64)

 

void TriggerOnTransferStart(TransferDirection direction, Int64 size)

 

Sub TriggerOnTransferStart(direction As TransferDirection, size As Int64)

Parameters:

  • direction:
  • size:

Validate

 

method Validate

 

void Validate()

 

Sub Validate()

 

Chunked

 

property Chunked: Boolean read;

 

Boolean Chunked { get; }

 

ReadOnly Property Chunked() As Boolean

Client  protected    (declared in HttpRequestResponse)

 

property Client: Boolean read;

 

Boolean Client { get; }

 

ReadOnly Property Client() As Boolean

ContentBytes

Returns the HTTP body in form of a byte array.

Note that this method is not as efficient as the ContentStream method, as the entire body will be read into a memory buffer at once.

 

property ContentBytes: array of Byte read;

 

Byte[] ContentBytes { get; }

 

ReadOnly Property ContentBytes() As Byte()

ContentLength

Contains the ContentLength header value reveived from the remote side. If the remot did not provide a length (for example in HTTP 1.0 scenarios, or if Keep-Alive is not supported), accessing the property will raise an exception.

Use the HasContentLength property to determine if a valid ContentLength has been received.

 

property ContentLength: Int32 read;

 

Int32 ContentLength { get; }

 

ReadOnly Property ContentLength() As Int32

ContentStream

Returns a Stream object with the HTTP body of the received request (server) or response (client).

This object is a HttpIncomingStream, which provides direct access to the underling DataConnection, but is (at leats for HTTP 1.1) limited to the number of bytes indicated by the HTTP header. As such, the same limitations as for the Connection stream class apply, you can only rad it once and forward-only, and it does not support seeking or writing.

Because ContentStream provides you with direct access to the underlying Connection Stream, it is the fastest and most efficient way to access the response (as opposed to ContentString and ContentBytes, both of which involve copying the entire data from the stream into a memory buffer).

Note also, that you can easily use ContentStream to access and process even very large HTTP bodies (such as a huge file download), without the need to comy the entire body into memory, and without having to wait for the entire download to have finished before you can start processing it.

 

property ContentStream: Stream read;

 

Stream ContentStream { get; }

 

ReadOnly Property ContentStream() As Stream

ContentString

Returns the HTTP body in form of a String object.

Note that this method is the least efficient for accessing the HTTP body, as the entire body will first be read into a memory buffer (then accessible via ContentBytes), and then converted into a string by the assigned Encoding (Encoding.ASCII by default).

 

property ContentString: String read;

 

String ContentString { get; }

 

ReadOnly Property ContentString() As String

DataConnection

 

property DataConnection: Connection read;

 

Connection DataConnection { get; }

 

ReadOnly Property DataConnection() As Connection

Encoding    (declared in HttpRequestResponse)

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

HasContentLength

Specifies whether the HTTP header provides a ContentLength field.

 

property HasContentLength: Boolean read;

 

Boolean HasContentLength { get; }

 

ReadOnly Property HasContentLength() As Boolean

HasOnTransferProgress  protected    (declared in HttpRequestResponse)

 

property HasOnTransferProgress: Boolean read;

 

Boolean HasOnTransferProgress { get; }

 

ReadOnly Property HasOnTransferProgress() As Boolean

 

property Header: HttpHeaders read write;

 

HttpHeaders Header { get; set; }

 

Property Header() As HttpHeaders

KeepAlive

 

property KeepAlive: Boolean read;

 

Boolean KeepAlive { get; }

 

ReadOnly Property KeepAlive() As Boolean

Server  protected    (declared in HttpRequestResponse)

 

property Server: Boolean read;

 

Boolean Server { get; }

 

ReadOnly Property Server() As Boolean

 

constructor  protected    (declared in HttpRequestResponse)

 

constructor

 

HttpIncomingRequestResponse()

 

Sub New()

constructor (Connection, HttpHeaders)  protected

 

constructor(connection: Connection; headers: HttpHeaders)

 

HttpIncomingRequestResponse(Connection connection, HttpHeaders headers)

 

Sub New(connection As Connection, headers As HttpHeaders)

Parameters:

  • connection:
  • headers:

constructor (HttpHeaders)  protected    (declared in HttpRequestResponse)

 

constructor(header: HttpHeaders)

 

HttpIncomingRequestResponse(HttpHeaders header)

 

Sub New(header As HttpHeaders)

Parameters:

  • header:

CloneEvents    (declared in HttpRequestResponse)

 

method CloneEvents(source: HttpRequestResponse)

 

void CloneEvents(HttpRequestResponse source)

 

Sub CloneEvents(source As HttpRequestResponse)

Parameters:

  • source:

FlushContent

 

method FlushContent: Boolean

 

Boolean FlushContent()

 

Function FlushContent() As Boolean

TriggerOnTransferEnd  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferEnd(direction: TransferDirection)

 

void TriggerOnTransferEnd(TransferDirection direction)

 

Sub TriggerOnTransferEnd(direction As TransferDirection)

Parameters:

  • direction:

TriggerOnTransferProgress  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferProgress(direction: TransferDirection; position: Int64)

 

void TriggerOnTransferProgress(TransferDirection direction, Int64 position)

 

Sub TriggerOnTransferProgress(direction As TransferDirection, position As Int64)

Parameters:

  • direction:
  • position:

TriggerOnTransferStart  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferStart(direction: TransferDirection; size: Int64)

 

void TriggerOnTransferStart(TransferDirection direction, Int64 size)

 

Sub TriggerOnTransferStart(direction As TransferDirection, size As Int64)

Parameters:

  • direction:
  • size:

Validate

 

method Validate

 

void Validate()

 

Sub Validate()

 

OnTransferEnd    (declared in HttpRequestResponse)

 

event OnTransferEnd: EventHandler<TransferEndEventArgs>;

 

delegate EventHandler<TransferEndEventArgs> OnTransferEnd()

 

Event OnTransferEnd As EventHandler<TransferEndEventArgs>

OnTransferProgress    (declared in HttpRequestResponse)

 

event OnTransferProgress: EventHandler<TransferProgressEventArgs>;

 

delegate EventHandler<TransferProgressEventArgs> OnTransferProgress()

 

Event OnTransferProgress As EventHandler<TransferProgressEventArgs>

OnTransferStart    (declared in HttpRequestResponse)

 

event OnTransferStart: EventHandler<TransferStartEventArgs>;

 

delegate EventHandler<TransferStartEventArgs> OnTransferStart()

 

Event OnTransferStart As EventHandler<TransferStartEventArgs>