The HTTP Transfer-Encoding header indicates the encoding method used to transfer the message body between entities.
The HTTP Transfer-Encoding header is a hop-by-hop header that is used between any two nodes. It indicates the encoding method used for the message body in the current transmission. Different Transfer-Encoding methods may be used between nodes.
In cases where the HTTP Transfer-Encoding header is included in the response to an HTTP HEAD request, the Transfer-Encoding refers to the encoding to be applied to the message body had the request been HTTP GET instead.
The HTTP Transfer-Encoding header is not used in HTTP/2.
The Transfer-Encoding directives are
gzip. Directives can be included using separate HTTP headers or included on the same line in a comma-delimited format.
chunked directive implies that the client supports
trailer fields in a chunked transfer encoding.
compress directive uses the Lempel-Ziv-Welch (LZW) compression algorithm.
deflate directive uses a zlib structure to compress data.
gzip directive uses a Lempel-Zif encoding method and maintains a 32-bit CRC.
In this example, the
compress directive is used.
Rather than specifying the encoding between individual nodes, it is possible to specify the encoding for the entire message between the client and the server. However, this requires the use of the HTTP Content-Encoding header.
The HTTP Transfer-Encoding header is used to indicate what encoding methods are used for the current message and refers only to the connection between two nodes on a hop-by-hop basis.