ClassHttpRequest
Used to create and manipulate an HTTP request.
Definition
Namespace:ArtOfTest.WebAii.Messaging.Http
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class HttpRequest
Inheritance: objectHttpRequest
Constructors
HttpRequest(byte[])
Create a new HttpRequest object from the given network data
Declaration
public HttpRequest(byte[] buffer)
Parameters
buffer
byte[]
A buffer containing the network data that will be parsed to generate an HttpRequest object
Properties
Content
Gets / Sets the content of this request
DecodedBody
Returns a string representing the body; HTTP chunking and (known) compression types are removed, and the text encoding specified by the content is used.
Guid
Gets the unique identifier of this request
HasCloseConnectionOption
Gets whether this request specifies that the connection be closed after a response to it is received
Headers
Gets / Sets the headers for this request
Declaration
public NameValueCollection Headers { get; set; }
Property Value
HttpMethod
Gets / Sets the HTTP method of this request
HttpVersion
Gets / Sets the HTTP version string of this request
ID
Gets the ID number of this request
RequestUri
Gets / Sets the URI of this request.
Declaration
public string RequestUri { get; set; }
Property Value
Remarks
The URI should not contain the server to which the request is directed. It should only contain the path on the server of the requested resource. The server's IP address or DNS name should be stored in the 'Host' header. For example, to request the page 'http://www.example.com/directory/file.html', the URI string should be "/directory/file.html" and the Host header should be "www.example.com".
Response
Gets / Sets the response to this request. If a response is set, the request will not be sent to the server.
Declaration
public HttpResponse Response { get; set; }
Property Value
Methods
CleanUpConnectionOptions()
Strips out any headers matching the tokens listed in the Connection header, and removes all tokens from the Connection header except for 'close'.
Declaration
public void CleanUpConnectionOptions()
GetPostFormContent()
Declaration
public NameValueCollection GetPostFormContent()
Returns
ToByteArray()
Rebuilds the HTTP query
Declaration
public byte[] ToByteArray()
Returns
byte[]
A byte array representing the rebuilt HTTP query string.
ToString()
Converts this HTTP request object to a string representation. HTTP request header information will not be included.
Declaration
public override string ToString()
Returns
A string representation of this header request.
Overrides
ToString(bool)
Converts this HTTP request object to a string representation.