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.Boolean
|
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.IObservable<System.Boolean>
|
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.IObservable<System.Boolean>
|
EnabledRulesCountObservable
Observable used to stream the count of enabled rules to the client
Declaration
public IObservable<int> EnabledRulesCountObservable { get; }
Property Value
System.IObservable<System.Int32>
|
IsEnabled
True if the AutoResponder feature is Enabled; false otherwise.
Declaration
public virtual bool IsEnabled { get; set; }
Property Value
System.Boolean
|
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.Boolean
|
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.Boolean
|
RuleMatchCountObservable
Observable for rules that have their Fiddler.ResponderRule.iCurrentMatchCount updated
Declaration
public IObservable<ValueTuple<string, int>> RuleMatchCountObservable { get; }
Property Value
System.IObservable<System.ValueTuple<System.String, System.Int32>>
|
Rules
Gets the list of all rules in all groups in no particular order
Declaration
public virtual List<ResponderRule> Rules { get; }
Property Value
System.Collections.Generic.List<ResponderRule>
|
UseLatency
Should per-rule latency values be used?
Declaration
public bool UseLatency { get; set; }
Property Value
System.Boolean
|
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.String
id
The id to use for the new group |
System.String
name
The name to use for the new group |
System.String
parent
The id of the parent group (if child) |
System.Boolean
isEnabled
Should the group be enabled initially |
Returns
ResponderGroup
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.String
sRule
The string to match |
HTTPResponseHeaders
oRH
The list or response headers to send (not required) |
System.Byte[]
arrResponseBody
The response body to send (not required) |
System.String
sDescription
A description of that reply |
System.Int32
iLatencyMS
Milliseconds of latency (0 if not needed) |
System.Boolean
bEnabled
True to enable the rule |
Returns
ResponderRule
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.String
sMatch
The rule match string (encoded) |
HTTPResponseHeaders
oResponseHeaders
The list or response headers to send (not required) |
System.Byte[]
arrResponseBody
The response body to send (not required) |
System.String
sAction
The rule action string (encoded) |
System.String
name
The name/comment for the rule |
System.Int32
iLatencyMS
Milliseconds of latency (0 if not needed) |
System.Boolean
bEnabled
True to enable the rule |
System.Nullable<System.Boolean>
hasFinalAction
True if rule has a final action |
Returns
ResponderRule
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.String
sMatch
The rule match string (encoded) |
HTTPResponseHeaders
oResponseHeaders
The list or response headers to send (not required) |
System.Byte[]
arrResponseBody
The response body to send (not required) |
System.String
sAction
The rule action string (encoded) |
System.String
name
The name/comment for the rule |
System.Int32
iLatencyMS
Milliseconds of latency (0 if not needed) |
System.Boolean
bEnabled
True to enable the rule |
System.Nullable<System.Boolean>
hasFinalAction
True if rule has a final action |
System.Boolean
shouldUpdateResponseActions
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, 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.String
sRule
The string to match |
Session
oImportedSession
The sdession to use for rule response |
System.String
sDescription
A description of that reply |
System.Boolean
bEnabled
True to enable the rule |
Returns
ResponderRule
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.String
sRule
The string to match |
Session
oImportedSession
The sdession to use for rule response |
System.String
sDescription
A description of that reply |
System.Int32
iLatencyMS
Milliseconds of latency (0 if not needed) |
System.Boolean
bEnabled
True to enable the rule |
Returns
ResponderRule
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.String
sRule
The string to match |
System.String
sAction
The response file or action |
System.Boolean
bIsEnabled
True to enable the rule |
Returns
ResponderRule
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.String
sRule
The string to match |
System.String
sAction
The response file or action |
System.String
sComment
The name(comment) of the rule |
System.Boolean
bIsEnabled
True to enable the rule |
System.Nullable<System.Boolean>
hasFinalAction
True if rule has a final action |
Returns
ResponderRule
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.Collections.Generic.Dictionary<System.String, ResponderGroup>
|
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.String
sFilename
The location of the .SAZ file |
GetPasswordDelegate
fnPasswordCallback
Delegate to use to prompt for password if importing encrypted archive |
System.Boolean
bUsePlaybackHeuristics
Should 401s be filtered out? |
Returns
System.Boolean
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.String
sAnnotation
The annotation to add to the UI display for the Session |
System.Boolean
bUsePlaybackHeuristics
Should 401s be filtered out? |
System.Boolean
bWithoutGroup
If we should skip creating group |
Returns
System.String[]
TRUE if import succeeded. |
LoadRules(String)
Load options and Rules from an XML File
Declaration
public bool LoadRules(string sFilename)
Parameters
System.String
sFilename
The name of the file |
Returns
System.Boolean
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.String
sFilename
The name of the file |
System.Boolean
bIsDefaultRuleFile
TRUE if the OPTIONS should be respected |
Returns
System.Boolean
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.String
sFilename
The name of the file |
System.Boolean
resetRules
TRUE if the rules should be cleaned before importing |
System.Boolean
respectOptions
TRUE if the OPTIONS should be respected from the provided XML file |
System.String
groupName
The name of the parent group (if doing partial import) to use. If not set, group name is auto generated. |
Returns
System.Boolean
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
ResponderGroup
group
The group to remove |
System.Boolean
getLock
Whether to get a writer lock on the rules/groups collections (set to false if already got a lock elsewhere) |
Returns
System.Boolean
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
ResponderRule
oRule
The rule to remove |
Returns
System.Boolean
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
ResponderItem
rule
The rule to change. |
System.Int32
newIndex
The new rule index in the group. |
Returns
System.Boolean
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.String
sFilename
The name of the file |
System.Collections.Generic.IEnumerable<System.String>
itemIds
A list of rule indexes to save. If omitted then all rules are saved. |
Returns
System.Boolean
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.String
Multi-line string containing rules. |
UpdateEnabledRulesCount()
Update the enabled rules subject used for status bar information
Declaration
public virtual void UpdateEnabledRulesCount()