ClassAutoResponder
The AutoResponder object manages automatic responses to requests.
Definition
Namespace:Fiddler
Assembly:FiddlerCore.dll
Syntax:
public class AutoResponder
Inheritance: objectAutoResponder
Inherited Members
Properties
AcceptAllConnects
TRUE if AutoResponder should respond to CONNECTs with 200
AcceptAllConnectsObservable
This observable is used to stream the value of the Accept All Connects rules option to the client
Declaration
public IObservable<bool> AcceptAllConnectsObservable { get; }
Property Value
Enabled
This observable is used to stream the enabled state of Fiddler rules to the client
Declaration
public IObservable<bool> Enabled { get; }
Property Value
EnabledRulesCountObservable
Observable used to stream the count of enabled rules to the client
Declaration
public IObservable<int> EnabledRulesCountObservable { get; }
Property Value
IsEnabled
True if the AutoResponder feature is Enabled; false otherwise.
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.
PermitFallthrough
TRUE if requests that match no AutoResponder rule are permitted to proceed to the network
Declaration
public virtual bool PermitFallthrough { get; set; }
Property Value
RuleMatchCountObservable
Observable for rules that have their updated
Declaration
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
public virtual List<ResponderRule> Rules { get; }
Property Value
UseLatency
Should per-rule latency values be used?
Methods
AddGroup(string, string, string, bool)
Create a new rule group
Declaration
public ResponderGroup AddGroup(string id, string name, string parent, bool isEnabled)
Parameters
id
The id to use for the new group
name
The name to use for the new group
parent
The id of the parent group (if child)
isEnabled
Should the group be enabled initially
Returns
The newly created group
AddRule(string, HTTPResponseHeaders, byte[], string, int, bool)
Create a new autoresponse rule and add it to the listview
Declaration
public ResponderRule AddRule(string sRule, HTTPResponseHeaders oRH, byte[] arrResponseBody, string sDescription, int iLatencyMS, bool bEnabled)
Parameters
sRule
The string to match
oRH
The list or response headers to send (not required)
arrResponseBody
byte[]
The response body to send (not required)
sDescription
A description of that reply
iLatencyMS
Milliseconds of latency (0 if not needed)
bEnabled
True to enable the rule
Returns
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
public ResponderRule AddRule(string sMatch, HTTPResponseHeaders oResponseHeaders, byte[] arrResponseBody, string sAction, string name, int iLatencyMS, bool bEnabled, bool? hasFinalAction = null)
Parameters
sMatch
The rule match string (encoded)
oResponseHeaders
The list or response headers to send (not required)
arrResponseBody
byte[]
The response body to send (not required)
sAction
The rule action string (encoded)
name
The name/comment for the rule
iLatencyMS
Milliseconds of latency (0 if not needed)
bEnabled
True to enable the rule
hasFinalAction
bool?
True if rule has a final action
Returns
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
public ResponderRule AddRule(string sMatch, HTTPResponseHeaders oResponseHeaders, byte[] arrResponseBody, string sAction, string name, int iLatencyMS, bool bEnabled, bool? hasFinalAction, bool shouldUpdateResponseActions)
Parameters
sMatch
The rule match string (encoded)
oResponseHeaders
The list or response headers to send (not required)
arrResponseBody
byte[]
The response body to send (not required)
sAction
The rule action string (encoded)
name
The name/comment for the rule
iLatencyMS
Milliseconds of latency (0 if not needed)
bEnabled
True to enable the rule
hasFinalAction
bool?
True if rule has a final action
shouldUpdateResponseActions
TRUE if the rule is added via new rule import from file. FALSE when loading rules from the Default rule file
Returns
The Rule created, or null
AddRule(string, Session, string, bool)
Create a new autoresponse rule and add it to the listview
Declaration
[Obsolete("Please use another constructor!")]
public ResponderRule AddRule(string sRule, Session oImportedSession, string sDescription, bool bEnabled)
Parameters
sRule
The string to match
oImportedSession
The sdession to use for rule response
sDescription
A description of that reply
bEnabled
True to enable the rule
Returns
The Rule created, or null
AddRule(string, Session, string, int, bool)
Create a new autoresponse rule and add it to the listview
Declaration
[Obsolete("Please use another constructor!")]
public ResponderRule AddRule(string sRule, Session oImportedSession, string sDescription, int iLatencyMS, bool bEnabled)
Parameters
sRule
The string to match
oImportedSession
The sdession to use for rule response
sDescription
A description of that reply
iLatencyMS
Milliseconds of latency (0 if not needed)
bEnabled
True to enable the rule
Returns
The Rule created, or null
AddRule(string, string, bool)
Create a new autoresponse rule and add it to the listview
Declaration
[Obsolete("Please use another constructor!")]
public ResponderRule AddRule(string sRule, string sAction, bool bIsEnabled)
Parameters
sRule
The string to match
sAction
The response file or action
bIsEnabled
True to enable the rule
Returns
The Rule created, or null
AddRule(string, string, string, bool, bool?)
Create a new autoresponse rule and add it to the listview
Declaration
public ResponderRule AddRule(string sRule, string sAction, string sComment, bool bIsEnabled, bool? hasFinalAction = null)
Parameters
sRule
The string to match
sAction
The response file or action
sComment
The name(comment) of the rule
bIsEnabled
True to enable the rule
hasFinalAction
bool?
True if rule has a final action
Returns
The Rule created, or null
ClearRules()
Clear all rules from the current AutoResponder list
Declaration
public virtual void ClearRules()
EmitSettings()
Notify all AcceptAllConnects, Enabled property subscribers with the current property values.
Declaration
public virtual void EmitSettings()
GetGroups()
Returns the list of responder groups
Declaration
public virtual Dictionary<string, ResponderGroup> GetGroups()
Returns
ImportSAZ(string, GetPasswordDelegate, bool)
Imports the sessions from .SAZ archive and create rules for the sessions inside
Declaration
public bool ImportSAZ(string sFilename, GetPasswordDelegate fnPasswordCallback, bool bUsePlaybackHeuristics = false)
Parameters
sFilename
The location of the .SAZ file
fnPasswordCallback
Delegate to use to prompt for password if importing encrypted archive
bUsePlaybackHeuristics
Should 401s be filtered out?
Returns
FALSE if there was an error in loading
ImportSessions(Session[], string, bool, bool)
Imports sessions for replay
Declaration
public string[] ImportSessions(Session[] oSessions, string sAnnotation, bool bUsePlaybackHeuristics, bool bWithoutGroup = false)
Parameters
oSessions
Session[]
The set of Sessions
sAnnotation
The annotation to add to the UI display for the Session
bUsePlaybackHeuristics
Should 401s be filtered out?
bWithoutGroup
If we should skip creating group
Returns
string[]
TRUE if import succeeded.
LoadRules(string)
Load options and Rules from an XML File
LoadRules(string, bool)
Load a set of rules from an XML File
LoadRules(string, bool, bool, string)
Load a set of rules from an XML File
Declaration
public virtual bool LoadRules(string sFilename, bool resetRules, bool respectOptions, string groupName = null)
Parameters
sFilename
The name of the file
resetRules
TRUE if the rules should be cleaned before importing
respectOptions
TRUE if the OPTIONS should be respected from the provided XML file
groupName
The name of the parent group (if doing partial import) to use. If not set, group name is auto generated.
Returns
TRUE if the load was successful
RemoveGroup(ResponderGroup, bool)
Remove a group from the list of groups
Declaration
public bool RemoveGroup(ResponderGroup group, bool getLock = true)
Parameters
group
The group to remove
getLock
Whether to get a writer lock on the rules/groups collections (set to false if already got a lock elsewhere)
Returns
True if group was removed, False if there was an error
RemoveRule(ResponderRule)
Remove a rule from the list of rules
Declaration
public bool RemoveRule(ResponderRule oRule)
Parameters
oRule
The rule to remove
Returns
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
public bool ReorderItem(ResponderItem rule, int newIndex)
Parameters
rule
The rule to change.
newIndex
The new rule index in the group.
Returns
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
public virtual bool SaveRules(string sFilename, IEnumerable<string> itemIds = null)
Parameters
sFilename
The name of the file
itemIds
A list of rule indexes to save. If omitted then all rules are saved.
Returns
False if the file cannot be saved (an exception was caught)
ToString()
Describes the contents of the AutoResponder list
Declaration
public override string ToString()
Returns
Multi-line string containing rules.
Overrides
UpdateEnabledRulesCount()
Update the enabled rules subject used for status bar information
Declaration
public virtual void UpdateEnabledRulesCount()