Class
AutoResponder

The AutoResponder object manages automatic responses to requests.

Definition

Namespace:Fiddler

Assembly:FiddlerCore.dll

Syntax:

cs-api-definition
public class AutoResponder

Inheritance: objectAutoResponder

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

Properties

AcceptAllConnects

TRUE if AutoResponder should respond to CONNECTs with 200

Declaration

cs-api-definition
public bool AcceptAllConnects { get; set; }

Property Value

bool

AcceptAllConnectsObservable

This observable is used to stream the value of the Accept All Connects rules option to the client

Declaration

cs-api-definition
public IObservable<bool> AcceptAllConnectsObservable { get; }

Property Value

IObservable<bool>

Enabled

This observable is used to stream the enabled state of Fiddler rules to the client

Declaration

cs-api-definition
public IObservable<bool> Enabled { get; }

Property Value

IObservable<bool>

EnabledRulesCountObservable

Observable used to stream the count of enabled rules to the client

Declaration

cs-api-definition
public IObservable<int> EnabledRulesCountObservable { get; }

Property Value

IObservable<int>

IsEnabled

True if the AutoResponder feature is Enabled; false otherwise.

Declaration

cs-api-definition
public virtual bool IsEnabled { get; set; }

Property Value

bool

IsRuleListDirty

Gets or Sets a flag indicating whether the rule-list has been modified. This member points out an architectural flaw, since direct modification of the rule should set the dirty bit for the list automatically. Ah well, live and learn.

Declaration

cs-api-definition
public bool IsRuleListDirty { get; set; }

Property Value

bool

PermitFallthrough

TRUE if requests that match no AutoResponder rule are permitted to proceed to the network

Declaration

cs-api-definition
public virtual bool PermitFallthrough { get; set; }

Property Value

bool

RuleMatchCountObservable

Observable for rules that have their updated

Declaration

cs-api-definition
public IObservable<(string, int)> RuleMatchCountObservable { get; }

Property Value

IObservable<(string, int)>

Rules

Gets the list of all rules in all groups in no particular order

Declaration

cs-api-definition
public virtual List<ResponderRule> Rules { get; }

Property Value

List<ResponderRule>

UseLatency

Should per-rule latency values be used?

Declaration

cs-api-definition
public bool UseLatency { get; set; }

Property Value

bool

Methods

AddGroup(string, string, string, bool)

Create a new rule group

Declaration

cs-api-definition
public ResponderGroup AddGroup(string id, string name, string parent, bool isEnabled)

Parameters

id

string

The id to use for the new group

name

string

The name to use for the new group

parent

string

The id of the parent group (if child)

isEnabled

bool

Should the group be enabled initially

Returns

ResponderGroup

The newly created group

AddRule(string, HTTPResponseHeaders, byte[], string, int, bool)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
public ResponderRule AddRule(string sRule, HTTPResponseHeaders oRH, byte[] arrResponseBody, string sDescription, int iLatencyMS, bool bEnabled)

Parameters

sRule

string

The string to match

oRH

HTTPResponseHeaders

The list or response headers to send (not required)

arrResponseBody

byte[]

The response body to send (not required)

sDescription

string

A description of that reply

iLatencyMS

int

Milliseconds of latency (0 if not needed)

bEnabled

bool

True to enable the rule

Returns

ResponderRule

The Rule created, or null

AddRule(string, HTTPResponseHeaders, byte[], string, string, int, bool, bool?)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
public ResponderRule AddRule(string sMatch, HTTPResponseHeaders oResponseHeaders, byte[] arrResponseBody, string sAction, string name, int iLatencyMS, bool bEnabled, bool? hasFinalAction = null)

Parameters

sMatch

string

The rule match string (encoded)

oResponseHeaders

HTTPResponseHeaders

The list or response headers to send (not required)

arrResponseBody

byte[]

The response body to send (not required)

sAction

string

The rule action string (encoded)

name

string

The name/comment for the rule

iLatencyMS

int

Milliseconds of latency (0 if not needed)

bEnabled

bool

True to enable the rule

hasFinalAction

bool?

True if rule has a final action

Returns

ResponderRule

The Rule created, or null

AddRule(string, HTTPResponseHeaders, byte[], string, string, int, bool, bool?, bool)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
public ResponderRule AddRule(string sMatch, HTTPResponseHeaders oResponseHeaders, byte[] arrResponseBody, string sAction, string name, int iLatencyMS, bool bEnabled, bool? hasFinalAction, bool shouldUpdateResponseActions)

Parameters

sMatch

string

The rule match string (encoded)

oResponseHeaders

HTTPResponseHeaders

The list or response headers to send (not required)

arrResponseBody

byte[]

The response body to send (not required)

sAction

string

The rule action string (encoded)

name

string

The name/comment for the rule

iLatencyMS

int

Milliseconds of latency (0 if not needed)

bEnabled

bool

True to enable the rule

hasFinalAction

bool?

True if rule has a final action

shouldUpdateResponseActions

bool

TRUE if the rule is added via new rule import from file. FALSE when loading rules from the Default rule file

Returns

ResponderRule

The Rule created, or null

AddRule(string, Session, string, bool)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
[Obsolete("Please use another constructor!")]
public ResponderRule AddRule(string sRule, Session oImportedSession, string sDescription, bool bEnabled)

Parameters

sRule

string

The string to match

oImportedSession

Session

The sdession to use for rule response

sDescription

string

A description of that reply

bEnabled

bool

True to enable the rule

Returns

ResponderRule

The Rule created, or null

AddRule(string, Session, string, int, bool)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
[Obsolete("Please use another constructor!")]
public ResponderRule AddRule(string sRule, Session oImportedSession, string sDescription, int iLatencyMS, bool bEnabled)

Parameters

sRule

string

The string to match

oImportedSession

Session

The sdession to use for rule response

sDescription

string

A description of that reply

iLatencyMS

int

Milliseconds of latency (0 if not needed)

bEnabled

bool

True to enable the rule

Returns

ResponderRule

The Rule created, or null

AddRule(string, string, bool)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
[Obsolete("Please use another constructor!")]
public ResponderRule AddRule(string sRule, string sAction, bool bIsEnabled)

Parameters

sRule

string

The string to match

sAction

string

The response file or action

bIsEnabled

bool

True to enable the rule

Returns

ResponderRule

The Rule created, or null

AddRule(string, string, string, bool, bool?)

Create a new autoresponse rule and add it to the listview

Declaration

cs-api-definition
public ResponderRule AddRule(string sRule, string sAction, string sComment, bool bIsEnabled, bool? hasFinalAction = null)

Parameters

sRule

string

The string to match

sAction

string

The response file or action

sComment

string

The name(comment) of the rule

bIsEnabled

bool

True to enable the rule

hasFinalAction

bool?

True if rule has a final action

Returns

ResponderRule

The Rule created, or null

ClearRules()

Clear all rules from the current AutoResponder list

Declaration

cs-api-definition
public virtual void ClearRules()

EmitSettings()

Notify all AcceptAllConnects, Enabled property subscribers with the current property values.

Declaration

cs-api-definition
public virtual void EmitSettings()

GetGroups()

Returns the list of responder groups

Declaration

cs-api-definition
public virtual Dictionary<string, ResponderGroup> GetGroups()

Returns

Dictionary<string, ResponderGroup>

ImportSAZ(string, GetPasswordDelegate, bool)

Imports the sessions from .SAZ archive and create rules for the sessions inside

Declaration

cs-api-definition
public bool ImportSAZ(string sFilename, GetPasswordDelegate fnPasswordCallback, bool bUsePlaybackHeuristics = false)

Parameters

sFilename

string

The location of the .SAZ file

fnPasswordCallback

GetPasswordDelegate

Delegate to use to prompt for password if importing encrypted archive

bUsePlaybackHeuristics

bool

Should 401s be filtered out?

Returns

bool

FALSE if there was an error in loading

ImportSessions(Session[], string, bool, bool)

Imports sessions for replay

Declaration

cs-api-definition
public string[] ImportSessions(Session[] oSessions, string sAnnotation, bool bUsePlaybackHeuristics, bool bWithoutGroup = false)

Parameters

oSessions

Session[]

The set of Sessions

sAnnotation

string

The annotation to add to the UI display for the Session

bUsePlaybackHeuristics

bool

Should 401s be filtered out?

bWithoutGroup

bool

If we should skip creating group

Returns

string[]

TRUE if import succeeded.

LoadRules(string)

Load options and Rules from an XML File

Declaration

cs-api-definition
public bool LoadRules(string sFilename)

Parameters

sFilename

string

The name of the file

Returns

bool

TRUE if the load was successful

LoadRules(string, bool)

Load a set of rules from an XML File

Declaration

cs-api-definition
public virtual bool LoadRules(string sFilename, bool bIsDefaultRuleFile)

Parameters

sFilename

string

The name of the file

bIsDefaultRuleFile

bool

TRUE if the OPTIONS should be respected

Returns

bool

TRUE if the load was successful

LoadRules(string, bool, bool, string)

Load a set of rules from an XML File

Declaration

cs-api-definition
public virtual bool LoadRules(string sFilename, bool resetRules, bool respectOptions, string groupName = null)

Parameters

sFilename

string

The name of the file

resetRules

bool

TRUE if the rules should be cleaned before importing

respectOptions

bool

TRUE if the OPTIONS should be respected from the provided XML file

groupName

string

The name of the parent group (if doing partial import) to use. If not set, group name is auto generated.

Returns

bool

TRUE if the load was successful

RemoveGroup(ResponderGroup, bool)

Remove a group from the list of groups

Declaration

cs-api-definition
public bool RemoveGroup(ResponderGroup group, bool getLock = true)

Parameters

group

ResponderGroup

The group to remove

getLock

bool

Whether to get a writer lock on the rules/groups collections (set to false if already got a lock elsewhere)

Returns

bool

True if group was removed, False if there was an error

RemoveRule(ResponderRule)

Remove a rule from the list of rules

Declaration

cs-api-definition
public bool RemoveRule(ResponderRule oRule)

Parameters

oRule

ResponderRule

The rule to remove

Returns

bool

True if rule was removed, False if there was an error

ReorderItem(ResponderItem, int)

Change the priority (index) of a rule in its parent

Declaration

cs-api-definition
public bool ReorderItem(ResponderItem rule, int newIndex)

Parameters

rule

ResponderItem

The rule to change.

newIndex

int

The new rule index in the group.

Returns

bool

True if the operation was successful, false if the rule was not moved.

SaveRules(string, IEnumerable<string>)

Save the rules to the specified file

Declaration

cs-api-definition
public virtual bool SaveRules(string sFilename, IEnumerable<string> itemIds = null)

Parameters

sFilename

string

The name of the file

itemIds

IEnumerable<string>

A list of rule indexes to save. If omitted then all rules are saved.

Returns

bool

False if the file cannot be saved (an exception was caught)

ToString()

Describes the contents of the AutoResponder list

Declaration

cs-api-definition
public override string ToString()

Returns

string

Multi-line string containing rules.

Overrides object.ToString()

UpdateEnabledRulesCount()

Update the enabled rules subject used for status bar information

Declaration

cs-api-definition
public virtual void UpdateEnabledRulesCount()