Fiddler查看IP和响应时间
一、Fiddler查看IP地址
1、Rules -> CustomRules
小知识:QQ截图
先按住Ctrl 再 Alt 然后 鼠标右键 再按住 A 即可截图鼠标右键
此处 先按住Ctrl 再 Alt 然后 鼠标左键点击rules 再按住 A 即可截图
2、ctrl + f 搜索 static function Main
3、在Main函数里加入下面一行代码:
FiddlerObject.UI.lvSessions.AddBoundColumn("ServerIP",120,"X-HostIP");
二、Fiddler添加查看响应时间
1、Rules -> CustomRules
2、Ctrl + F 搜索 class Handlers
3、在class Handlers 里面添加
function BeginRequestTime(oS: Session)
{
if (oS.Timers != null)
{
return oS.Timers.ClientBeginRequest.ToString();
}
return String.Empty;
}
public static BindUIColumn("Time Taken")
function CalcTimingCol(oS: Session)
{
var sResult = String.Empty;
if ((oS.Timers.ServerDoneResponse > oS.Timers.ClientDoneRequest))
{
sResult = (oS.Timers.ServerDoneResponse - oS.Timers.ClientDoneRequest).ToString();
}
return sResult;
}
或者
public static BindUIColumn("TimeTaken/ms" ,120)
function TimeTaken(oS: Session): String{
var sResult = "0";
//获得时间戳的ms值
var t1_ms = oS.Timers.ClientBeginResponse.ToUniversalTime().Millisecond;
//获得时间戳的minute值
var t1_m = oS.Timers.ClientBeginResponse.ToUniversalTime().Minute;
//获得时间戳的second值
var t1_s = oS.Timers.ClientBeginResponse.ToUniversalTime().Second;
var t1 = t1_m*60*1000 + t1_s*1000 + t1_ms ;
var t2_ms = oS.Timers.ClientDoneRequest.ToUniversalTime().Millisecond;
var t2_m = oS.Timers.ClientDoneRequest.ToUniversalTime().Minute;
var t2_s = oS.Timers.ClientDoneRequest.ToUniversalTime().Second;
var t2 = t2_m*60*1000 + t2_s*1000 + t2_ms ;
if(t1 >= t2){
var t3 = t1 - t2;
sResult = t3.toString();
}
return sResult;
}
毫秒单位。
保存并关闭,重启fiddler后即可
标签:Fiddler,IP,t2,t1,响应,Timers,var,sResult,oS
来源: https://www.cnblogs.com/lonelyxmas/p/11437477.html