Open In App
Related Articles

HTTP headers | Transfer-Encoding

Like Article
Save Article
Report issue
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 Transfer-Encoding values. There is an end-to-end Content-Encoding header that can be use to compress the data over the whole connection. syntax:
Transfer-Encoding: chunked | compress | deflate | gzip | identity
Directives: 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 '\r\n'.
  • 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.
Note: The terminating chunks are the regular chunks, length of those chunks by default zero. Example: 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 
Content-Type: text/plain 
Transfer-Encoding: chunked

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. Supported Browsers: The browsers are compatible with HTTP Transfer-Encoding header are listed below:
  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

Last Updated : 31 Oct, 2019
Like Article
Save Article
Share your thoughts in the comments
Similar Reads