本文整理汇总了C#中Fiddler.Session.SetBitFlag方法的典型用法代码示例。如果您正苦于以下问题:C# Session.SetBitFlag方法的具体用法?C# Session.SetBitFlag怎么用?C# Session.SetBitFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fiddler.Session
的用法示例。
在下文中一共展示了Session.SetBitFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleHTTPError
internal static void HandleHTTPError(Session oSession, SessionFlags flagViolation, bool bPoisonClientConnection, bool bPoisonServerConnection, string sMessage)
{
if (bPoisonClientConnection)
{
oSession.PoisonClientPipe();
}
if (bPoisonServerConnection)
{
oSession.PoisonServerPipe();
}
oSession.SetBitFlag(flagViolation, true);
oSession["ui-backcolor"] = "LightYellow";
Log.LogFormat("{0} - [#{1}] {2}", new object[] { "Fiddler.Network.ProtocolViolation", oSession.id.ToString(), sMessage });
sMessage = "[ProtocolViolation] " + sMessage;
if ((oSession["x-HTTPProtocol-Violation"] == null) || !oSession["x-HTTPProtocol-Violation"].Contains(sMessage))
{
Session session;
(session = oSession)["x-HTTPProtocol-Violation"] = session["x-HTTPProtocol-Violation"] + sMessage;
}
}
示例2: 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;
}