• Add Columns to the Web Sessions List


    To add custom columns to the Web Sessions Listadd rules using FiddlerScript.

    The BindUIColumn Attribute

    To fill a custom column, add a method labeled with the BindUIColumn attribute. Fiddler will run the method on each session to fill the custom column. (To avoid exceptions, be sure that your method is robust and checks to ensure that objects exist before use!) For example:

    Fill custom column with session HTTP Method

        public static BindUIColumn("HTTPMethod")
               function CalcMethodCol(oS: Session){
                      if (null != oS.oRequest) return oS.oRequest.headers.HTTPMethod; else return String.Empty; 
               }

    Fill custom column with time taken for session

        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;
               }

    There are four overloads for BindUIColumn that allow you to set the width, display order, and whether the column should be sorted numerically.

    BindUIColumn(string colName)
    
    BindUIColumn(string colName, bool bSortColumnNumerically)
    
    public BindUIColumn(string colName, int iColWidth)
    
    public BindUIColumn(string colName, int iColWidth, int iDisplayOrder)

    The AddBoundColumn method

    Alternatively, you can call the AddBoundColumn() method. The first parameter is the name with which the column should be named, and the second parameter is the default width of the column. The third parameter is either a Fiddler Session Flag string, an @-prefixed-header name, or a JavaScript function that returns a string.

        static function Main()
        {
                FiddlerObject.UI.lvSessions.AddBoundColumn("ClientPort", 50, "X-ClientPort");
                FiddlerObject.UI.lvSessions.AddBoundColumn("SentCookie1", 60, getSentCookie);
                FiddlerObject.UI.lvSessions.AddBoundColumn("SentCookie2", 60, "@request.Cookie");
                FiddlerObject.UI.lvSessions.AddBoundColumn("ReturnedCookie", 60, "@response.Set-Cookie");
        }
    
        static function getSentCookie(oS: Session){ if (null != oS.oRequest) return oS.oRequest["Cookie"]; }
  • 相关阅读:
    搭建php环境时解决jpeg6 make: ./libtool:命令未找到
    configure: error: zlib not installed
    南京呼叫中心防火墙配置(备份)
    检查Linux Bash安全漏洞以及各环境修复解决方法
    Linux 内核升级步骤
    CentOS 7没有ifconfig命令处理
    linux kickstart 自动安装
    red hat Linux 使用CentOS yum源更新
    -bash: ./job.sh: /bin/sh^M: bad interpreter: 没有那个文件或目录
    linux LNMP自动安装脚本
  • 原文地址:https://www.cnblogs.com/hushaojun/p/10667679.html
Copyright © 2020-2023  润新知