当前位置: 首页>>代码示例>>C#>>正文


C# Session.SetBitFlag方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:pisceanfoot,项目名称:socketproxy,代码行数:20,代码来源:FiddlerApplication.cs

示例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;
 }
开发者ID:pisceanfoot,项目名称:socketproxy,代码行数:59,代码来源:Proxy.cs


注:本文中的Fiddler.Session.SetBitFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。