Jscript Samples

Create column showing savings if GZIP used

public static BindUIColumn("GZIP Savings", 60)
    function FillSizeColumn(oS: Session){
        if (!oS.bHasResponse) return String.Empty;
 
        if (null == oS.responseBodyBytes || (1 > oS.responseBodyBytes.LongLength)){ return "0 / 0" };
 
        var iO: long;
        var iC: long;
 
        iO = oS.responseBodyBytes.LongLength; 
 
        if (!oS.oResponse.headers.Exists["Content-Encoding"] ) 
        { 
            iC = Fiddler.Utilities.GzipCompress(oS.responseBodyBytes).LongLength; 
        } 
        else {
            iC = iO;
        }
 
        var pct: double;
        pct = 1 - (iC/iO);
        return iC.ToString() + " / " + iO.ToString() + " (save " + pct.ToString("p") + ")";
    }
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License