diff --git a/content/blog/http-content-and-transfer-encoding.md b/content/blog/http-content-and-transfer-encoding.md index 2e28eeb..03a06f5 100644 --- a/content/blog/http-content-and-transfer-encoding.md +++ b/content/blog/http-content-and-transfer-encoding.md @@ -5,7 +5,7 @@ date = 2024-03-19 An HTTP message comprises a request line (a request method, an URL and a protocol version) or status line (a protocol version and a response status code) followed by a list of headers and a message body separated with an empty line. The request/status line and the headers are plain text, while the message body can be any content (specified by `Content-Type`), including binary, optionally encoded. -How the message body is encoded is described by one of two mutually exclusive headers: `Transfer-Encoding` and `Content-Encoding`. Compression and chunked transfer encoding are two main reasons behind encoding the message body. The goal of compression is to improve the performance by reducing the amount of data transferred, although it does impose additional work for the server and the client. With chunked transfer coding a large message body is broken down into into chunks transferred separately. This enables piece by piece data transfer, sending messages where the size is not known ahead of time and streaming of large media. +How the message body is encoded is described by one of two mutually exclusive headers: `Transfer-Encoding` and `Content-Encoding`. Compression and chunked transfer encoding are two main reasons behind encoding the message body. The goal of compression is to improve the performance by reducing the amount of data transferred, although it does impose additional work for the server and the client. With chunked transfer coding a large message body is broken down into chunks transferred separately. This enables piece by piece data transfer, sending messages where the size is not known ahead of time and streaming of large media. Although the HTTP specification permits the use of compression with either of the headers, in practice the only widely supported option of `Transfer-Encoding` is `chunked` while compression is implemented using `Content-Encoding` header.