0

I can see how I can script an overall latency in Fiddler using the ScriptEditor, using something like this:

if (oSession.HostnameIs("www.testsite.co.uk")) {
    oSession["request-trickle-delay"] = "500";
}

However, I need to be more specific and specify a delay between the first packet of the request which contains the header, and the secondary packets that contain the body.

I am trying to simulate a problem that is occurring with 0.3% of our web clients, from whom we are receiving a request header, but a missing request body. There is no consistent user agent. Various browsers and operating systems appear to be affected. All POST requests are originating from XMLHttpRequests (XHR). They look like this, and contain JSON bodies:

POST http://www.sitename.co.uk/folder/controller/list HTTP/1.1
Host: www.sitename.co.uk
Connection: keep-alive
Content-Length: 245
Accept: application/json, text/javascript, */*; q=0.01
Origin: http://www.sitename.co.uk
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17
Content-Type: application/json
Referer: http://www.sitename.co.uk/folder/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: **removed**

{"bb":{"tl":{"lat":51.590527931951975,"lng":-0.636399852539089},"tr":{"lat":51.590527931951975,"lng":0.42652739355466096},"bl":{"lat":51.29736817638294,"lng":-0.636399852539089},"br":{"lat":51.29736817638294,"lng":0.42652739355466096}},"b":true}

I have checked the MTU size set at firewall level and it is set to 1500, which I believe to be fine.

The web servers are behind a load balancer and are running IIS 7.5 on Windows Server 2008 R2 64-bit. Website is running on ASP.NET MVC3.

Rebecca
  • 13,914
  • 10
  • 95
  • 136

1 Answers1

1

It's worth mentioning that headers may be in more than one TCP/IP packet, and there's nothing that requires that the body be in a different packet than the headers. But I assume you're using the term packet loosely

Fiddler v2.4.2.6 has a Request-Body-Delay session flag that would enable the delay you're looking for; set it to e.g. 5000 to delay the body by 5 seconds. (v2.4.2.6 is currently in alpha: https://fiddler2.com/dl/fiddler2alphasetup.exe)

FWIW, it's possible that the headers were sent but the POST body wasn't. That can happen in IE if you have a buggy plugin installed (see Why is IE 10 Refusing to send POST data via jQuery $.ajax for an example).

This problem can also occur if the connection is dropped. For instance, if you are attempting to do a POST in the OnBeforeUnload method, the headers may be sent but the process killed before the POST body is emitted.

Community
  • 1
  • 1
EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • Regarding number of packets used by different browsers for a HTTP POST, there is a nice run down here: http://josephscott.org/archives/2009/08/xmlhttprequest-xhr-uses-multiple-packets-for-http-post/ – Rebecca Jan 17 '13 at 09:14
  • Delay works. Sadly, I couldn't replicate the bug by adding the delay. – Rebecca Jan 17 '13 at 14:05
  • @Junto: Yeah, I wouldn't expect the delay to be a problem; I think the culprits I suggest are likely the cause. – EricLaw Jan 17 '13 at 20:56
  • The first reason I can rule out because the issue is being seen across a wide variety of browsers. The second is possible, but the incident rate is high, and connections dropping would seem to be an isolated case. We aren't using OnBeforeUnload. This is a XHR request that is called as a map zoom is altered. These requests can be queued up though. Maybe the queuing is a problem. – Rebecca Jan 18 '13 at 11:07
  • Browsers can abort the XHR if the user navigates away or closes the tab. Similarly, you can't necessarily exclude #1 because it could be caused by an intermediary like an antivirus proxy service (these are becoming common). – EricLaw Jan 18 '13 at 22:27