How to display HTTP request size in Fiddler?

I would like to display the size of each request in the list of violinist sessions. So far, I have been trying to add a custom column to the CustomRules.js file:

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

But this leads to an error when the script tries to load the script.

If I changed the line with a comment to this:

  return typeof(oS.requestBodyBytes.Length); 

then fiddler displays the "number" in the RequestSize column. Because of this, I assume that I am not very far from what I am trying to achieve. I just can't figure out how to display the size of the requestBodyBytes field.

Any clues what am I doing wrong or what is missing?

+7
fiddler web-traffic
source share
2 answers

Refresh . In modern versions of Fiddler, you can simply right-click the column headers, select Customize Columns, and add the Miscellaneous > Request Size column.


Depending on your needs, this may not be exactly what you want to do, as it only displays the length of the request body and does not include the size of the headers.

Here's an improved version:

 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(); } 
+7
source

Well, I knew that not far off. Here is the answer to my question.

This script, when placed in CustomRules.js, will print the length / size of the HTTP request in the violin:

 public static BindUIColumn("Req-Length") function CalcMethodCol(oS: Session){ if (null != oS.oRequest) return oS.requestBodyBytes.LongLength.ToString(); else return String.Empty; } 
+4
source

All Articles