C# Class TrotiNet.BaseProxyLogic

Implement the full HTTP proxy logic for one browser connection
Inheritance: AbstractProxyLogic
Show file Open project: Gizeta/Nekoxy-fiddler

Protected Properties

Property Type Description
RequestHeaders HttpHeaders
RequestLine HttpRequestLine
ResponseHeaders HttpHeaders
ResponseStatusLine HttpStatusLine
State RequestProcessingState

Public Methods

Method Description
BaseProxyLogic ( HttpSocket socketBP ) : System

Base proxy constructor (an arbitrary intermediate step between AbstractProxyLogic, and ProxyLogic)

LogicLoop ( ) : bool

Implement a base proxy logic. The procedure is called for each request as long as it returns true.

Protected Methods

Method Description
AbortRequest ( ) : void

Pipeline step: close the connections and stop

HandleConnect ( ) : void

A specific case for the CONNECT command, connect both ends blindly (will work for HTTPS, SSH and others)

OnReceiveRequest ( ) : void

Called when RequestLine and RequestHeaders are set

May be used to override State.NextStep

OnReceiveResponse ( ) : void

Called when ResponseStatusLine and ResponseHeaders are set

May be used to override State.NextStep

ReadRequest ( ) : void

Pipeline step: read the HTTP request from the client, schedule the next step to be SendRequest, and call OnReceiveRequest

ReadResponse ( ) : void

Pipeline step: read the HTTP response from the local client, schedule the next step to be SendResponse, and call OnReceiveResponse

SendRequest ( ) : void

Pipeline step: tunnel the request from the client to the remove server, and schedule the next step to be ReadResponse

SendResponse ( ) : void

Pipeline: tunnel the HTTP response from the remote server to the local client, and end the request processing

SendResponseStatusAndHeaders ( ) : void

Send the response status line and headers from the proxy to the client

Private Methods

Method Description
HandleWebSocket ( ) : void

Handle a websocket handshake and tunnel the two ends

Method Details

AbortRequest() protected method

Pipeline step: close the connections and stop
protected AbortRequest ( ) : void
return void

BaseProxyLogic() public method

Base proxy constructor (an arbitrary intermediate step between AbstractProxyLogic, and ProxyLogic)
public BaseProxyLogic ( HttpSocket socketBP ) : System
socketBP HttpSocket
return System

HandleConnect() protected method

A specific case for the CONNECT command, connect both ends blindly (will work for HTTPS, SSH and others)
protected HandleConnect ( ) : void
return void

LogicLoop() public method

Implement a base proxy logic. The procedure is called for each request as long as it returns true.
public LogicLoop ( ) : bool
return bool

OnReceiveRequest() protected method

Called when RequestLine and RequestHeaders are set
May be used to override State.NextStep
protected OnReceiveRequest ( ) : void
return void

OnReceiveResponse() protected method

Called when ResponseStatusLine and ResponseHeaders are set
May be used to override State.NextStep
protected OnReceiveResponse ( ) : void
return void

ReadRequest() protected method

Pipeline step: read the HTTP request from the client, schedule the next step to be SendRequest, and call OnReceiveRequest
protected ReadRequest ( ) : void
return void

ReadResponse() protected method

Pipeline step: read the HTTP response from the local client, schedule the next step to be SendResponse, and call OnReceiveResponse
protected ReadResponse ( ) : void
return void

SendRequest() protected method

Pipeline step: tunnel the request from the client to the remove server, and schedule the next step to be ReadResponse
protected SendRequest ( ) : void
return void

SendResponse() protected method

Pipeline: tunnel the HTTP response from the remote server to the local client, and end the request processing
protected SendResponse ( ) : void
return void

SendResponseStatusAndHeaders() protected method

Send the response status line and headers from the proxy to the client
protected SendResponseStatusAndHeaders ( ) : void
return void

Property Details

RequestHeaders protected property

The request headers of the HTTP request currently being handled
protected HttpHeaders RequestHeaders
return HttpHeaders

RequestLine protected property

The request line of the HTTP request currently being handled
protected HttpRequestLine,TrotiNet RequestLine
return HttpRequestLine

ResponseHeaders protected property

The response header line of the HTTP response received
protected HttpHeaders ResponseHeaders
return HttpHeaders

ResponseStatusLine protected property

The response status line of the HTTP response received
protected HttpStatusLine,TrotiNet ResponseStatusLine
return HttpStatusLine

State protected property

Request processing pipeline state
protected RequestProcessingState State
return RequestProcessingState