本文整理汇总了C#中Fiddler.Session.ExecuteUponAsyncRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Session.ExecuteUponAsyncRequest方法的具体用法?C# Session.ExecuteUponAsyncRequest怎么用?C# Session.ExecuteUponAsyncRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fiddler.Session
的用法示例。
在下文中一共展示了Session.ExecuteUponAsyncRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendRequest
public Session SendRequest(HTTPRequestHeaders oHeaders, byte[] arrRequestBodyBytes, StringDictionary oNewFlags, EventHandler<StateChangeEventArgs> onStateChange)
{
if (oHeaders.ExistsAndContains("Fiddler-Encoding", "base64"))
{
oHeaders.Remove("Fiddler-Encoding");
if (!Utilities.IsNullOrEmpty(arrRequestBodyBytes))
{
arrRequestBodyBytes = Convert.FromBase64String(Encoding.ASCII.GetString(arrRequestBodyBytes));
if (oNewFlags == null)
{
oNewFlags = new StringDictionary();
}
oNewFlags["x-Builder-FixContentLength"] = "CFE-required";
}
}
if (oHeaders.Exists("Fiddler-Host"))
{
if (oNewFlags == null)
{
oNewFlags = new StringDictionary();
}
oNewFlags["x-OverrideHost"] = oHeaders["Fiddler-Host"];
oNewFlags["X-IgnoreCertCNMismatch"] = "Overrode HOST";
oHeaders.Remove("Fiddler-Host");
}
if ((oNewFlags != null) && oNewFlags.ContainsKey("x-Builder-FixContentLength"))
{
if ((arrRequestBodyBytes != null) && !oHeaders.ExistsAndContains("Transfer-Encoding", "chunked"))
{
if (!Utilities.HTTPMethodAllowsBody(oHeaders.HTTPMethod) && (arrRequestBodyBytes.Length == 0))
{
oHeaders.Remove("Content-Length");
}
else
{
oHeaders["Content-Length"] = arrRequestBodyBytes.LongLength.ToString();
}
}
else
{
oHeaders.Remove("Content-Length");
}
}
Session session = new Session((HTTPRequestHeaders) oHeaders.Clone(), arrRequestBodyBytes);
session.SetBitFlag(SessionFlags.RequestGeneratedByFiddler, true);
if (onStateChange != null)
{
session.OnStateChanged += onStateChange;
}
if ((oNewFlags != null) && (oNewFlags.Count > 0))
{
foreach (DictionaryEntry entry in oNewFlags)
{
session.oFlags[(string) entry.Key] = oNewFlags[(string) entry.Key];
}
}
session.ExecuteUponAsyncRequest();
return session;
}