C# Class Org.Mentalis.Proxy.Http.HttpClient

Relays HTTP data between a remote host and a local client.
This class supports both HTTP and HTTPS.
Inheritance: Org.Mentalis.Proxy.Client
显示文件 Open project: mcorrientes/Web-Security-Toolset Class Usage Examples

Private Properties

Property Type Description
IsValidQuery bool
OnConnected void
OnErrorSent void
OnOkSent void
OnQuerySent void
OnReceiveQuery void
ParseQuery System.Collections.Specialized.StringDictionary
ProcessQuery void
RebuildQuery string
SendBadRequest void

Public Methods

Method Description
HttpClient ( Socket ClientSocket, DestroyDelegate Destroyer ) : System

Initializes a new instance of the HttpClient class.

StartHandshake ( ) : void

Starts receiving data from the client connection.

ToString ( ) : string

Returns text information about this HttpClient object.

ToString ( bool WithUrl ) : string

Returns text information about this HttpClient object.

Private Methods

Method Description
IsValidQuery ( string Query ) : bool

Checks whether a specified string is a valid HTTP query string.

OnConnected ( IAsyncResult ar ) : void

Called when we're connected to the requested remote host.

OnErrorSent ( IAsyncResult ar ) : void

Called when the Bad Request error has been sent to the client.

OnOkSent ( IAsyncResult ar ) : void

Called when an OK reply has been sent to the local client.

OnQuerySent ( IAsyncResult ar ) : void

Called when the HTTP query has been sent to the remote host.

OnReceiveQuery ( IAsyncResult ar ) : void

Called when we received some data from the client connection.

ParseQuery ( string Query ) : StringDictionary

Parses a specified HTTP query into its header fields.

ProcessQuery ( string Query ) : void

Processes a specified query and connects to the requested HTTP web server.

If there's an error while processing the HTTP request or when connecting to the remote server, the Proxy sends a "400 - Bad Request" error to the client.

RebuildQuery ( ) : string

Rebuilds the HTTP query, starting from the HttpRequestType, RequestedPath, HttpVersion and HeaderFields properties.

SendBadRequest ( ) : void

Sends a "400 - Bad Request" error to the client.

Method Details

HttpClient() public method

Initializes a new instance of the HttpClient class.
public HttpClient ( Socket ClientSocket, DestroyDelegate Destroyer ) : System
ClientSocket Socket The Socket connection between this proxy server and the local client.
Destroyer DestroyDelegate The callback method to be called when this Client object disconnects from the local client and the remote server.
return System

StartHandshake() public method

Starts receiving data from the client connection.
public StartHandshake ( ) : void
return void

ToString() public method

Returns text information about this HttpClient object.
public ToString ( ) : string
return string

ToString() public method

Returns text information about this HttpClient object.
public ToString ( bool WithUrl ) : string
WithUrl bool Specifies whether or not to include information about the requested URL.
return string