Class AutoResponder
The AutoResponder object manages automatic responses to requests.
Inheritance
Namespace: Fiddler
Assembly: FiddlerCore.dll
Syntax
public class AutoResponder : Object
Properties
AcceptAllConnects
TRUE if AutoResponder should respond to CONNECTs with 200
Declaration
public bool AcceptAllConnects { get; set; }
Property Value
System.
|
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
System.
|
Enabled
This observable is used to stream the enabled state of Fiddler rules to the client
Declaration
public IObservable<bool> Enabled { get; }
Property Value
System.
|
EnabledRulesCountObservable
Observable used to stream the count of enabled rules to the client
Declaration
public IObservable<int> EnabledRulesCountObservable { get; }
Property Value
System.
|
IsEnabled
True if the AutoResponder feature is Enabled; false otherwise.
Declaration
public virtual bool IsEnabled { get; set; }
Property Value
System.
|
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
public bool IsRuleListDirty { get; set; }
Property Value
System.
|
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
System.
|
RuleMatchCountObservable
Observable for rules that have their Fiddler.
Declaration
public IObservable<ValueTuple<string, int>> RuleMatchCountObservable { get; }
Property Value
System.
|
Rules
Gets the list of all rules in all groups in no particular order
Declaration
public virtual List<ResponderRule> Rules { get; }
Property Value
System.
|
UseLatency
Should per-rule latency values be used?
Declaration
public bool UseLatency { get; set; }
Property Value
System.
|
Methods
AddGroup(String, String, String, Boolean)
Create a new rule group
Declaration
public ResponderGroup AddGroup(string id, string name, string parent, bool isEnabled)
Parameters
System. The id to use for the new group |
System. The name to use for the new group |
System. The id of the parent group (if child) |
System. Should the group be enabled initially |
Returns
Responder The newly created group |
AddRule(String, HTTPResponseHeaders, Byte[], String, Int32, Boolean)
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
System. The string to match |
HTTPResponse The list or response headers to send (not required) |
System. The response body to send (not required) |
System. A description of that reply |
System. Milliseconds of latency (0 if not needed) |
System. True to enable the rule |
Returns
Responder The Rule created, or null |
AddRule(String, HTTPResponseHeaders, Byte[], String, String, Int32, Boolean, Nullable<Boolean>)
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, Nullable<bool> hasFinalAction = null)
Parameters
System. The rule match string (encoded) |
HTTPResponse The list or response headers to send (not required) |
System. The response body to send (not required) |
System. The rule action string (encoded) |
System. The name/comment for the rule |
System. Milliseconds of latency (0 if not needed) |
System. True to enable the rule |
System. True if rule has a final action |
Returns
Responder The Rule created, or null |
AddRule(String, HTTPResponseHeaders, Byte[], String, String, Int32, Boolean, Nullable<Boolean>, Boolean)
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, Nullable<bool> hasFinalAction, bool shouldUpdateResponseActions)
Parameters
System. The rule match string (encoded) |
HTTPResponse The list or response headers to send (not required) |
System. The response body to send (not required) |
System. The rule action string (encoded) |
System. The name/comment for the rule |
System. Milliseconds of latency (0 if not needed) |
System. True to enable the rule |
System. True if rule has a final action |
System. TRUE if the rule is added via new rule import from file. FALSE when loading rules from the Default rule file |
Returns
Responder The Rule created, or null |
AddRule(String, Session, String, Boolean)
Create a new autoresponse rule and add it to the listview
Declaration
public ResponderRule AddRule(string sRule, Session oImportedSession, string sDescription, bool bEnabled)
Parameters
System. The string to match |
Session
oImportedSession
The sdession to use for rule response |
System. A description of that reply |
System. True to enable the rule |
Returns
Responder The Rule created, or null |
AddRule(String, Session, String, Int32, Boolean)
Create a new autoresponse rule and add it to the listview
Declaration
public ResponderRule AddRule(string sRule, Session oImportedSession, string sDescription, int iLatencyMS, bool bEnabled)
Parameters
System. The string to match |
Session
oImportedSession
The sdession to use for rule response |
System. A description of that reply |
System. Milliseconds of latency (0 if not needed) |
System. True to enable the rule |
Returns
Responder The Rule created, or null |
AddRule(String, String, Boolean)
Create a new autoresponse rule and add it to the listview
Declaration
public ResponderRule AddRule(string sRule, string sAction, bool bIsEnabled)
Parameters
System. The string to match |
System. The response file or action |
System. True to enable the rule |
Returns
Responder The Rule created, or null |
AddRule(String, String, String, Boolean, Nullable<Boolean>)
Create a new autoresponse rule and add it to the listview
Declaration
public ResponderRule AddRule(string sRule, string sAction, string sComment, bool bIsEnabled, Nullable<bool> hasFinalAction = null)
Parameters
System. The string to match |
System. The response file or action |
System. The name(comment) of the rule |
System. True to enable the rule |
System. True if rule has a final action |
Returns
Responder 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
System.
|
ImportSAZ(String, GetPasswordDelegate, Boolean)
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
System. The location of the .SAZ file |
Get Delegate to use to prompt for password if importing encrypted archive |
System. Should 401s be filtered out? |
Returns
System. FALSE if there was an error in loading |
ImportSessions(Session[], String, Boolean, Boolean)
Imports sessions for replay
Declaration
public string[] ImportSessions(Session[] oSessions, string sAnnotation, bool bUsePlaybackHeuristics, bool bWithoutGroup = false)
Parameters
Session[]
oSessions
The set of Sessions |
System. The annotation to add to the UI display for the Session |
System. Should 401s be filtered out? |
System. If we should skip creating group |
Returns
System. TRUE if import succeeded. |
LoadRules(String)
Load options and Rules from an XML File
Declaration
public bool LoadRules(string sFilename)
Parameters
System. The name of the file |
Returns
System. TRUE if the load was successful |
LoadRules(String, Boolean)
Load a set of rules from an XML File
Declaration
public virtual bool LoadRules(string sFilename, bool bIsDefaultRuleFile)
Parameters
System. The name of the file |
System. TRUE if the OPTIONS should be respected |
Returns
System. TRUE if the load was successful |
LoadRules(String, Boolean, Boolean, 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
System. The name of the file |
System. TRUE if the rules should be cleaned before importing |
System. TRUE if the OPTIONS should be respected from the provided XML file |
System. The name of the parent group (if doing partial import) to use. If not set, group name is auto generated. |
Returns
System. TRUE if the load was successful |
RemoveGroup(ResponderGroup, Boolean)
Remove a group from the list of groups
Declaration
public bool RemoveGroup(ResponderGroup group, bool getLock = true)
Parameters
Responder The group to remove |
System. Whether to get a writer lock on the rules/groups collections (set to false if already got a lock elsewhere) |
Returns
System. 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
Responder The rule to remove |
Returns
System. True if rule was removed, False if there was an error |
ReorderItem(ResponderItem, Int32)
Change the priority (index) of a rule in its parent
Declaration
public bool ReorderItem(ResponderItem rule, int newIndex)
Parameters
Responder The rule to change. |
System. The new rule index in the group. |
Returns
System. 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
System. The name of the file |
System. A list of rule indexes to save. If omitted then all rules are saved. |
Returns
System. 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
System. Multi-line string containing rules. |
UpdateEnabledRulesCount()
Update the enabled rules subject used for status bar information
Declaration
public virtual void UpdateEnabledRulesCount()