예제 #1
0
        /// <summary>
        /// 用文件替代response
        /// </summary>
        /// <param name="session"></param>
        /// <param name="path"></param>
        public static void LoadFileToResponse(Fiddler.Session session, string path)
        {
            var ct  = "text/html; charset=utf-8";
            var ext = System.IO.Path.GetExtension(path);

            //FiddlerLog("file ext:" + ext);
            if (".gif,.png,.jpg,.bmp,.jpeg,.webp".IndexOf(ext, StringComparison.OrdinalIgnoreCase) > -1)
            {
                ct = "image/" + ext.TrimStart('.');
            }

            if (System.IO.File.Exists(path))
            {
                ResetResponse(session, 200, ct);
                //var content = System.IO.File.ReadAllText(path, System.Text.Encoding.UTF8);
                //session.utilSetResponseBody(content);

                session.oResponse.headers.Add("jmFidExt_action", path);

                session.LoadResponseFromFile(path);
            }
            else
            {
                ResetResponse(session, 404, ct);
                session.utilSetResponseBody("文件:" + path + " 未找到");
            }
            //session.Ignore();
        }
예제 #2
0
 public void ReplaceUrl2(Fiddler.Session oS)
 {
     foreach (赛尔号登录器.Widget.代理器.MyINI j in myINI)
     {
         if (j.value2.IndexOf("工具") != -1)//判断是不是本地的资源
         {
             if (j.value3 == "真" && oS.uriContains(j.value1))
             {
                 oS.LoadResponseFromFile(path3 + j.value2);
             }
         }
     }
 }