- if (typeof this._transferSize === "number")
- return this._transferSize;
- if (this.statusCode === 304) // Not modified
- return this.responseHeadersSize;
- if (this._cached)
- return 0;
- // If we did not receive actual transfer size from network
- // stack, we prefer using Content-Length over resourceSize as
- // resourceSize may differ from actual transfer size if platform's
- // network stack performed decoding (e.g. gzip decompression).
- // The Content-Length, though, is expected to come from raw
- // response headers and will reflect actual transfer length.
- // This won't work for chunked content encoding, so fall back to
- // resourceSize when we don't have Content-Length. This still won't
- // work for chunks with non-trivial encodings. We need a way to
- // get actual transfer size from the network stack.
- var bodySize = Number(this.responseHeaderValue("Content-Length") || this.resourceSize);
- return this.responseHeadersSize + bodySize;