我想在fiddler的会话列表中显示每个请求的大小。到目前为止我尝试过的是在CustomRules.js文件中添加一个自定义列:

public static BindUIColumn("RequestSize")
function CalcMethodCol(oS: Session)
{
  if (null != oS.requestBodyBytes)
    return oS.requestBodyBytes.Length; //this is the relevant line
  else
    return "?";
}

但是当fiddler尝试加载脚本时,这会导致错误。

如果我将注释中的行更改为:

    return typeof(oS.requestBodyBytes.Length);

然后fiddler在RequestSize列中显示“number”。因此,我想我离我想要实现的目标并不是很远。我只是想不通如何显示requestBodyBytes字段的大小。

任何暗示我做错了什么或缺少什么?

有帮助吗?

解决方案

更新在现代版Fiddler中,您只需右键单击列标题,然后选择“自定义列”即可。并添加 Miscellaneous > Request Size 列。


根据您的需要,这可能不是您想要做的,因为它只显示请求正文的长度,并且不包括标题的大小。

以下是改进版本:

public  static  BindUIColumn("Req-Size")
function  CalcReqSize(oS:  Session){        
  if (null == oS.oRequest) return String.Empty;
  var cBytesOut: int = 0;

  if (null != oS.requestBodyBytes) cBytesOut += oS.requestBodyBytes.LongLength; 
  if ((null != oS.oRequest) && (null != oS.oRequest.headers)) cBytesOut += 
  oS.oRequest.headers.ByteCount() ; 
  return cBytesOut.ToString();
}

其他提示

好的,我知道我并不遥远。这是我的问题的答案。

此脚本放入CustomRules.js后,将在fiddler中打印HTTP请求的长度/大小:

public  static  BindUIColumn("Req-Length")
function  CalcMethodCol(oS:  Session){
    if (null != oS.oRequest)
            return oS.requestBodyBytes.LongLength.ToString();
        else
            return String.Empty;
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top