Class Proxy
The core proxy object which accepts connections from clients and creates session objects from those connections.
Inheritance
Namespace: Fiddler
Assembly: FiddlerCore.dll
Syntax
public class Proxy : Object, IDisposable
Properties
IsAttached
Returns true if Fiddler believes it is currently registered as the Local System proxy
Declaration
public bool IsAttached { get; set; }
Property Value
System.Boolean
|
IsListening
Returns true if the proxy is listening on a port.
Declaration
public bool IsListening { get; }
Property Value
System.Boolean
|
ListenPort
The port on which this instance is listening
Declaration
public int ListenPort { get; }
Property Value
System.Int32
|
Methods
AssignEndpointCertificate(X509Certificate2)
Assign HTTPS Certificate for this endpoint
Declaration
public void AssignEndpointCertificate(X509Certificate2 certHTTPS)
Parameters
System.Security.Cryptography.X509Certificates.X509Certificate2
certHTTPS
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
public bool Attach(out string error)
Parameters
System.String
error
|
Returns
System.Boolean
True if the proxy registration was successful |
Detach()
Detach the proxy by setting the registry keys and sending a Windows Message
Declaration
public bool Detach()
Returns
System.Boolean
True if the proxy settings were successfully detached |
Dispose()
Dispose Fiddler's listening socket
Declaration
public void Dispose()
FindGatewayForOrigin(String, String)
This function, when given a scheme host[:port], returns the gateway information of the proxy to forward requests to.
Declaration
public IPEndPoint FindGatewayForOrigin(string sURIScheme, string sHostAndPort)
Parameters
System.String
sURIScheme
URIScheme: use http, https, or ftp |
System.String
sHostAndPort
Host for which to return gateway information |
Returns
System.Net.IPEndPoint
IPEndPoint of gateway to use, or NULL |
GetWpadUrl()
Get WPAD-discovered URL
Declaration
public string GetWpadUrl()
Returns
System.String
A WPAD url, if found, null or string.Empty otherwise |
InjectCustomRequest(HTTPRequestHeaders, Byte[], Boolean, Boolean)
[DEPRECATED] Directly inject a session into the Fiddler pipeline. NOTE: This method will THROW any exceptions to its caller.
Declaration
public void InjectCustomRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, bool bRunRequestRules, bool bViewResult)
Parameters
HTTPRequestHeaders
oHeaders
HTTP Request Headers |
System.Byte[]
arrRequestBodyBytes
HTTP Request body (or null) |
System.Boolean
bRunRequestRules
Unused |
System.Boolean
bViewResult
Sets a flag to be used later when inspecting the session |
InjectCustomRequest(HTTPRequestHeaders, Byte[], StringDictionary)
[DEPRECATED] Directly inject a session into the Fiddler pipeline. NOTE: This method will THROW any exceptions to its caller.
Declaration
public void InjectCustomRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags)
Parameters
HTTPRequestHeaders
oHeaders
HTTP Request Headers |
System.Byte[]
arrRequestBodyBytes
HTTP Request body (or null) |
System.Collections.Specialized.StringDictionary
oNewFlags
StringDictionary of Session Flags (or null) |
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
public void InjectCustomRequest(string sRequest)
Parameters
System.String
sRequest
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
public void InjectCustomRequest(string sRequest, StringDictionary oNewFlags)
Parameters
System.String
sRequest
String representing the HTTP request. If headers only, be sure to end with CRLFCRLF |
System.Collections.Specialized.StringDictionary
oNewFlags
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
protected virtual void OnDetachedUnexpectedly()
PurgeServerPipePoolAsync()
Clear the pool of Server Pipes. May be called by extensions.
Declaration
public Task PurgeServerPipePoolAsync()
Returns
System.Threading.Tasks.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
[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
HTTPRequestHeaders
oHeaders
HTTP Request Headers |
System.Byte[]
arrRequestBodyBytes
HTTP Request body (or null) |
System.Collections.Specialized.StringDictionary
oNewFlags
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
[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
HTTPRequestHeaders
oHeaders
HTTP Request Headers |
System.Byte[]
arrRequestBodyBytes
HTTP Request body (or null) |
System.Collections.Specialized.StringDictionary
oNewFlags
StringDictionary of Session Flags (or null) |
System.EventHandler<StateChangeEventArgs>
onStateChange
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
public Session SendRequest(string sRequest, StringDictionary oNewFlags)
Parameters
System.String
sRequest
String representing the HTTP request. If headers only, be sure to end with CRLFCRLF |
System.Collections.Specialized.StringDictionary
oNewFlags
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
[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
HTTPRequestHeaders
oHeaders
HTTP Request Headers |
System.Byte[]
arrRequestBodyBytes
HTTP Request body (or null) |
System.Collections.Specialized.StringDictionary
oNewFlags
StringDictionary of Session Flags (or null) |
System.EventHandler<StateChangeEventArgs>
onStateChange
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
public override string ToString()
Returns
System.String
A multiline string |
Events
DetachedUnexpectedly
This event handler fires when Fiddler detects that it is (unexpectedly) no longer the system's registered proxy
Declaration
public event EventHandler DetachedUnexpectedly
Event Type
System.EventHandler
|