question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong bodySize (and feature request: add _transferSize)

See original GitHub issue

I’m test-running timing-fix branch code, found there are still a few fields missing from this chrome-har-capturer than a real Chrome DevTools, one is request headers, I can only see Referer and User-Agent while a real Chrome DevTools gives all headers sent in full, like Host: ..., Accept-Encoding: ... and others, I haven’t looked at the chrome remote debugging protocol, not even sure if remote-interface ever provided those, or can it be done in this chrome-har-capturer ??

          "headers": [
            {
              "name": "Referer",
              "value": "http://www.podcastone.com/widgetrecent?progID=877"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2716.0 Safari/537.36"
            }
          ],

Another one I found from a real Chrome DevTools is the _transferSize; when in transfer-encoding: chunked mode, the response is (a length + a chunk) + (length + chunk) + … + 0; so the real transferred bytes on the wire could be slightly larger than bodySize; I’m not sure which har viewer ever take use of the _transferSize but it can be used in real bandwith calculation or something, and it’s missing from this chrome-har-capturer

          "content": {
            "size": 118465,
            "mimeType": "text/html",
            "compression": 96200
          },
          "redirectURL": "",
          "headersSize": 662,
          "bodySize": 22265,
          "_transferSize": 22927

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cyrus-andcommented, Jun 1, 2016

So to summarize, the header problem is fixed now. While the bodySize (i.e., the on the wire body size) is reported incorrectly by Chrome. For example:

$ curl -s -H 'Accept-Encoding: gzip' http://example.com/ | wc -c
606

Which is also the value reported in the Content-Length header, is the correct one. While the HAR reports:

"headersSize": 372,
"bodySize": 978,
"content": {
    "size": 1270,
    "mimeType": "text/html",
    "compression": 292
}

Compared to the HAR generated by DevTools directly:

"headersSize": 372,
"bodySize": 606,
"content": {
  "size": 1270,
  "mimeType": "text/html"
  "compression": 664
},
"_transferSize": 978

Note that in both cases compression satisfies:

compression = size - bodySize
292 = 1270 - 978
664 = 1270 - 606
0reactions
cyrus-andcommented, Jun 9, 2016

OK, fixed. It seems that encodedDataLength represents the encoded payload plus the headers. I also added _transferSize.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What should transferSize, encodedBodySize and ...
I could see the case for making decodedBodySize match the body size of the response. All response data coming from the service worker...
Read more >
PerformanceResourceTiming.transferSize - Web APIs | MDN
A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body...
Read more >
ResourceTiming in Practice
transferSize : Bytes transferred for the HTTP response header and content body (ResourceTiming Level 2); decodedBodySize : Size of the body ...
Read more >
PerformanceResourceTiming.transferSize returns 0 in ...
I'm trying to get the total transfer size of some web pages. I don't know why but some web pages are returning 0...
Read more >
PerformanceResourceTiming.transferSize - Web APIs
A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found