HTTP headers | Transfer-Encoding
The HTTP Transfer-Encoding
is a response-type header that performs as the hop-by-hop header, the hop-by-hop header connection is the single transport-level connection must not be re-transmitted. This header is performing between two nodes (single transport-level connection). If there is multi-node connection then have to use other
values. There is an end-to-end
header that can be use to compress the data over the whole connection.
Transfer-Encoding: chunked | compress | deflate | gzip | identity
This header accepts five directives mentioned above and described below:
- chunked: This directive is used to send the series of data in a chunk format, but have to mentioned the length of each chunk before sending the chunk of the data in hexadecimal format like
'\r\n' and then the chunk itself, followed by another
- compress: It is a compression format using the Lempel-Ziv-Welch (LZW) algorithm.
- deflate: It is a compression format using the zlib structure, with the deflate compression algorithm.
- gzip: It is a compression format using the Lempel-Ziv coding (LZ77), with a 32-bit CRC.
- identity: This directive Indicates the identity function which is always acceptable.
The terminating chunks are the regular chunks, length of those chunks by default zero.
The chunk encoding for this header is useful when the server sending the huge amount of series of data to the client. The total size of the response may be unknown until the request has been completed. Suppose there is a large amount of data from a database query, a chunked response looks like this
HTTP/1.0 200 OK
To check this Transfer-Encoding in action go to Inspect Element -> Network
check the request header for Transfer-Encoding like below, Transfer-Encoding is highlighted you can see.
The browsers are compatible with HTTP Transfer-Encoding
header are listed below:
- Google Chrome
- Internet Explorer
Share your thoughts in the comments
Please Login to comment...