HttpServerRequest

Overview

The HttpServerRequest class is used by the HttpServer (and in the IpHttpServerChannel class that inherits from the HttpServer class) to represent the received Http request.

Location


 

constructor  protected    (declared in HttpRequestResponse)

 

constructor

 

HttpServerRequest()

 

Sub New()

constructor (Connection, HttpHeaders)

Creates a new instance of the HttpServerRequest class.

 

constructor(connection: Connection; headers: HttpHeaders)

 

HttpServerRequest(Connection connection, HttpHeaders headers)

 

Sub New(connection As Connection, headers As HttpHeaders)

Parameters:

  • connection: Http connection used to receive the data
  • headers: Collection of Http headers assotiated with the received Http request

constructor (HttpHeaders)  protected    (declared in HttpRequestResponse)

 

constructor(header: HttpHeaders)

 

HttpServerRequest(HttpHeaders header)

 

Sub New(header As HttpHeaders)

Parameters:

  • header:

Chunked    (declared in HttpIncomingRequestResponse)

 

property Chunked: Boolean read;

 

Boolean Chunked { get; }

 

ReadOnly Property Chunked() As Boolean

Client  protected

Gets flag indicating whether the request is being processed on the client side.

Returns false

 

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

 

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    (declared in HttpIncomingRequestResponse)

 

method FlushContent: Boolean

 

Boolean FlushContent()

 

Function FlushContent() As Boolean

HasContentLength    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

 

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>

Path

Gets the path of the current request.

 

property Path: String read;

 

String Path { get; }

 

ReadOnly Property Path() As String

QueryString

Gets the collection of HTTP query string variables.

 

property QueryString: QueryString read;

 

QueryString QueryString { get; }

 

ReadOnly Property QueryString() As QueryString

Server  protected

Gets flag indicating whether the request is being processed on the server side.

Returns true

 

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

Validates integrity of the current request instance (f.e. checks that the "Host" header is present in the Http headers collection assotiated with the current Http request).

 

method Validate

 

void Validate()

 

Sub Validate()

 

Chunked    (declared in HttpIncomingRequestResponse)

 

property Chunked: Boolean read;

 

Boolean Chunked { get; }

 

ReadOnly Property Chunked() As Boolean

Client  protected

Gets flag indicating whether the request is being processed on the client side.

Returns false

 

property Client: Boolean read;

 

Boolean Client { get; }

 

ReadOnly Property Client() As Boolean

ContentBytes    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

 

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    (declared in HttpIncomingRequestResponse)

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    (declared in HttpIncomingRequestResponse)

 

property KeepAlive: Boolean read;

 

Boolean KeepAlive { get; }

 

ReadOnly Property KeepAlive() As Boolean

Path

Gets the path of the current request.

 

property Path: String read;

 

String Path { get; }

 

ReadOnly Property Path() As String

QueryString

Gets the collection of HTTP query string variables.

 

property QueryString: QueryString read;

 

QueryString QueryString { get; }

 

ReadOnly Property QueryString() As QueryString

Server  protected

Gets flag indicating whether the request is being processed on the server side.

Returns true

 

property Server: Boolean read;

 

Boolean Server { get; }

 

ReadOnly Property Server() As Boolean

 

constructor  protected    (declared in HttpRequestResponse)

 

constructor

 

HttpServerRequest()

 

Sub New()

constructor (Connection, HttpHeaders)

Creates a new instance of the HttpServerRequest class.

 

constructor(connection: Connection; headers: HttpHeaders)

 

HttpServerRequest(Connection connection, HttpHeaders headers)

 

Sub New(connection As Connection, headers As HttpHeaders)

Parameters:

  • connection: Http connection used to receive the data
  • headers: Collection of Http headers assotiated with the received Http request

constructor (HttpHeaders)  protected    (declared in HttpRequestResponse)

 

constructor(header: HttpHeaders)

 

HttpServerRequest(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    (declared in HttpIncomingRequestResponse)

 

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

Validates integrity of the current request instance (f.e. checks that the "Host" header is present in the Http headers collection assotiated with the current Http request).

 

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>