Class
Proxy

The core proxy object which accepts connections from clients and creates session objects from those connections.

Definition

Namespace:Fiddler

Assembly:FiddlerCore.dll

Syntax:

cs-api-definition
public class Proxy : IDisposable

Inheritance: objectProxy

Implements: IDisposable

Inherited Members object.GetType()object.MemberwiseClone()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()

Properties

IsAttached

Returns true if Fiddler believes it is currently registered as the Local System proxy

Declaration

cs-api-definition
[Obsolete("Use Telerik.NetworkConnections.NetworkConnectionsManager.GetCurrentProxySettingsForConnection(*)/SetProxySettingsForConnections(*) to manipulate current proxy settings.")]
public bool IsAttached { get; set; }

Property Value

bool

IsListening

Returns true if the proxy is listening on a port.

Declaration

cs-api-definition
public bool IsListening { get; }

Property Value

bool

ListenPort

The port on which this instance is listening

Declaration

cs-api-definition
public int ListenPort { get; }

Property Value

int

Methods

AssignEndpointCertificate(X509Certificate2)

Assign HTTPS Certificate for this endpoint

Declaration

cs-api-definition
public void AssignEndpointCertificate(X509Certificate2 certHTTPS)

Parameters

certHTTPS

X509Certificate2

Certificate to return to clients who connect

Attach(out string)

Register as the system proxy for WinINET and set the Dynamic registry key for other FiddlerHook

Declaration

cs-api-definition
[Obsolete("Use Telerik.NetworkConnections.NetworkConnectionsManager.GetCurrentProxySettingsForConnection(*)/SetProxySettingsForConnections(*) to manipulate current proxy settings.")]
public bool Attach(out string error)

Parameters

error

string

Returns

bool

True if the proxy registration was successful

Detach()

Detach the proxy by setting the registry keys and sending a Windows Message

Declaration

cs-api-definition
[Obsolete("Use Telerik.NetworkConnections.NetworkConnectionsManager.GetCurrentProxySettingsForConnection(*)/SetProxySettingsForConnections(*) to manipulate current proxy settings.")]
public bool Detach()

Returns

bool

True if the proxy settings were successfully detached

Dispose()

Dispose Fiddler's listening socket

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

FindGatewayForOrigin(string, string)

This function, when given a scheme host[:port], returns the gateway information of the proxy to forward requests to.

Declaration

cs-api-definition
public IPEndPoint FindGatewayForOrigin(string sURIScheme, string sHostAndPort)

Parameters

sURIScheme

string

URIScheme: use http, https, or ftp

sHostAndPort

string

Host for which to return gateway information

Returns

IPEndPoint

IPEndPoint of gateway to use, or NULL

GetWpadUrl()

Get WPAD-discovered URL

Declaration

cs-api-definition
public string GetWpadUrl()

Returns

string

A WPAD url, if found, null or string.Empty otherwise

InjectCustomRequest(HTTPRequestHeaders, byte[], StringDictionary)

[DEPRECATED] Directly inject a session into the Fiddler pipeline. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
public void InjectCustomRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags)

Parameters

oHeaders

HTTPRequestHeaders

HTTP Request Headers

arrRequestBodyBytes

byte[]

HTTP Request body (or null)

oNewFlags

StringDictionary

StringDictionary of Session Flags (or null)

InjectCustomRequest(HTTPRequestHeaders, byte[], bool, bool)

[DEPRECATED] Directly inject a session into the Fiddler pipeline. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
[Obsolete("This overload of InjectCustomRequest is obsolete. Use a different version.", true)]
public void InjectCustomRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, bool bRunRequestRules, bool bViewResult)

Parameters

oHeaders

HTTPRequestHeaders

HTTP Request Headers

arrRequestBodyBytes

byte[]

HTTP Request body (or null)

bRunRequestRules

bool

Unused

bViewResult

bool

Sets a flag to be used later when inspecting the session

InjectCustomRequest(string)

[DEPRECATED]: This version does no validation of the request data, and doesn't set SessionFlags.RequestGeneratedByFiddler Send a custom HTTP request to Fiddler's listening endpoint (127.0.0.1:8888 by default). NOTE: This method will THROW any exceptions to its caller and blocks the current thread.

Declaration

cs-api-definition
public void InjectCustomRequest(string sRequest)

Parameters

sRequest

string

String representing the HTTP request. If headers only, be sure to end with CRLFCRLF

InjectCustomRequest(string, StringDictionary)

[DEPRECATED] Directly inject a session into the Fiddler pipeline. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
public void InjectCustomRequest(string sRequest, StringDictionary oNewFlags)

Parameters

sRequest

string

String representing the HTTP request. If headers only, be sure to end with CRLFCRLF

oNewFlags

StringDictionary

StringDictionary of Session Flags (or null)

OnDetachedUnexpectedly()

Raise the DetachedUnexpectedly event so the UI can react to Fiddler no longer registered as the system proxy.

Declaration

cs-api-definition
protected virtual void OnDetachedUnexpectedly()

PurgeServerPipePoolAsync()

Clear the pool of Server Pipes. May be called by extensions.

Declaration

cs-api-definition
public Task PurgeServerPipePoolAsync()

Returns

Task

SendRequest(HTTPRequestHeaders, byte[], StringDictionary)

Directly inject a session into the Fiddler pipeline, returning a reference to it. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
[CodeDescription("Send a custom request through the proxy. Hook the OnStateChanged event of the returned Session to monitor progress")]
public Session SendRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags)

Parameters

oHeaders

HTTPRequestHeaders

HTTP Request Headers

arrRequestBodyBytes

byte[]

HTTP Request body (or null)

oNewFlags

StringDictionary

StringDictionary of Session Flags (or null)

Returns

Session

The new Session

SendRequest(HTTPRequestHeaders, byte[], StringDictionary, EventHandler<StateChangeEventArgs>)

Directly inject a session into the Fiddler pipeline, returning a reference to it. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
[CodeDescription("Send a custom request through the proxy. Hook the OnStateChanged event of the returned Session to monitor progress")]
public Session SendRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags, EventHandler<StateChangeEventArgs> onStateChange)

Parameters

oHeaders

HTTPRequestHeaders

HTTP Request Headers

arrRequestBodyBytes

byte[]

HTTP Request body (or null)

oNewFlags

StringDictionary

StringDictionary of Session Flags (or null)

onStateChange

EventHandler<StateChangeEventArgs>

Event Handler to notify when the session changes state

Returns

Session

The new Session

SendRequest(string, StringDictionary)

Directly inject a session into the Fiddler pipeline, returning a reference to it. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
public Session SendRequest(string sRequest, StringDictionary oNewFlags)

Parameters

sRequest

string

String representing the HTTP request. If headers only, be sure to end with CRLFCRLF

oNewFlags

StringDictionary

StringDictionary of Session Flags (or null)

Returns

Session

The new session

SendRequestAndWait(HTTPRequestHeaders, byte[], StringDictionary, EventHandler<StateChangeEventArgs>)

Directly injects a session into the Fiddler pipeline, waits for it to finish (Done or Aborted) and returns a reference to it. NOTE: This method will THROW any exceptions to its caller.

Declaration

cs-api-definition
[CodeDescription("Send a custom request through the proxy, blocking until it completes (or aborts).")]
public Session SendRequestAndWait(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags, EventHandler<StateChangeEventArgs> onStateChange)

Parameters

oHeaders

HTTPRequestHeaders

HTTP Request Headers

arrRequestBodyBytes

byte[]

HTTP Request body (or null)

oNewFlags

StringDictionary

StringDictionary of Session Flags (or null)

onStateChange

EventHandler<StateChangeEventArgs>

Event Handler to notify when the session changes state

Returns

Session

The new Session

ToString()

Returns a string of information about this instance and the ServerPipe reuse pool

Declaration

cs-api-definition
public override string ToString()

Returns

string

A multiline string

Overrides object.ToString()

Events

DetachedUnexpectedly

This event handler fires when Fiddler detects that it is (unexpectedly) no longer the system's registered proxy

Declaration

cs-api-definition
public event EventHandler DetachedUnexpectedly

Event Value

EventHandler