Compressed download (HTTP)

There are two ways to transmit compressed data via HTTP: Content-Encoding and Transfer-Encoding.


Content-Encoding Transfer-Encoding
Request header Accept-Encoding: {algorithms} TE: {algorithms}
Response header Content-Encoding: {algorithms} Transfer-Encoding: {algorithms}
Influencer Client and Server Every node1
Supported / Used Widely Rarely
Pre-computed Likely No
‘Content-Length’ / ‘Ranges’ relates to … the compressed file … the uncompressed file

1 Every node in between can add / remove compression.

Client       Proxy1                      Proxy2       Server
  |            |                           |            |
  |----------->|                           |            |
  |HTTP GET    |                           |            |
  |            |-------------------------->|            |
  |            |HTTP GET                   |            |
  |            |TE: gzip                   |----------->|
  |            |                           |HTTP GET    |
  |            |                           |            |
  |            |                           |<-----------|
  |            |                           |    HTTP 200|
  |            |<--------------------------|            |
  |            |                   HTTP 200|            |
  |<-----------|    Transfer-Encoding: gzip|            |
  |    HTTP 200|                           |            |
  |            |                           |            |