Chunked Transfer Encoding

HTTP Chunked Transfer Encoding can be used when the HTTP body length is not know ahead of the transmission. The data to transmit will be split in chunks. Each chunk is preceded by the hexadecimal code of the chunk's size. The last chunk is empty to inform the receiver that the data has been fully transferred. Chunked Transfer Encoding can be used by HTTP client and server, although many servers don't support it in reception yet.

Figure - Chunked Transfer Encoding Image



µC/HTTP-server

µC/HTTP-server can support the Chunked Transfer Encoding in transmission only.

A hook function (see On Response Chunk Hook) needs to be set up to transmit data with the Chunked Transfer Encoding.

See also section Response Body Data for more information on this feature.

µC/HTTP-client

µC/HTTP-client supports the Chunked Transfer Encoding for reception and transmission. 

In reception, nothing needs to be done by the Application since the µC/HTTP-client stack supports it by default. HTTP Response body will be received by the application in the hook function (see Response Body Hook) regardless of whether it was received with the Chunked Transfer Encoding or not.

In transmission, a hook function (see Request Body Hook) needs to be set up to transmit data with the Chunked Transfer Encoding.

See Section Chunked Transfer Encoding Configuration to enable the Chunked Transfer Encoding feature.

See Section Chunked Transfer Encoding for examples on how to send data with the Chunked Transfer Encoding.