HTTP response
An HTTP response is made up of three parts, each separated by a CRLF (\r\n):
- Status line.
- Zero or more headers, each ending with a CRLF.
- Optional response body.
HTTP request
An HTTP request is made up of three parts, each separated by a CRLF (\r\n):
- Request line.
- Zero or more headers, each ending with a CRLF.
- Optional request body.
Here’s an example of an HTTP request:
GET /index.html HTTP/1.1\r\nHost: localhost:4221\r\nUser-Agent: curl/7.64.1\r\nAccept: */*\r\n\r\n