[ProgressEvents] How to deal with compressed transfer encodings

Hi All,

How should ProgressEvents deal with compressed transfer encodings? The
problem is that the Content-Length header (if I understand things
correctly) contains the encoded number of bytes, so we don't have
access to the total number of bytes which will be exposed to the user
until it's all downloaded. I can see several solutions:

A) Set "total" to 0, and "loaded" to the number of decompressed bytes
downloaded so far
B) Set "total" to the contents of the Content-Length header and
"loaded" the number of compressed bytes downloaded so far
C) Like A, but also expose a percentage downloaded which is based on
the compressed data

B seems spec-wise the simplest, but at least gecko doesn't expose the
compressed number of bytes downloaded, not sure about other HTTP
libraries. It also has the downside that .loaded doesn't match
.responseText.length

C seems the most confusing for authors and the one I like the least.

/ Jonas

Received on Tuesday, 23 November 2010 21:42:07 UTC