Transfer-Encoding header specifies the form of encoding used to safely transfer the entity to the user.
Transfer-Encoding is a hop-by-hop header, that is applying to a message between two nodes, not to a resource itself. Each segment of a multi-node connection can use different
Transfer-Encoding values. If you want to compress data over the whole connection, use the end-to-end header
Content-Encoding header instead.
Transfer-Encoding: chunked Transfer-Encoding: compress Transfer-Encoding: deflate Transfer-Encoding: gzip Transfer-Encoding: identity // Several values can be listed, separated by a comma Transfer-Encoding: gzip, chunked
Content-Lengthheader is omitted in this case and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format, followed by '
\r\n' and then the chunk itself, followed by another '
\r\n'. The terminating chunk is a regular chunk, with the exception that its length is zero. It is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields.
x-gzipas an alias, for compatibility purposes.
Chunked encoding is useful when larger amounts of data are sent to the client and the total size of the response may not be known until the request has been fully processed. For example, when generating a large HTML table resulting from a database query or when transmitting large images. A chunked response looks like this:
HTTP/1.1 200 OK Content-Type: text/plain Transfer-Encoding: chunked 7\r\n Mozilla\r\n 9\r\n Developer\r\n 7\r\n Network\r\n 0\r\n \r\n
|RFC 7230, section 3.3.1: Transfer-Encoding||Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing|
|Feature||Android webview||Chrome for Android||Edge mobile||Firefox for Android||IE mobile||Opera Android||iOS Safari|
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.