http-server

HTTP response

An HTTP response is made up of three parts, each separated by a CRLF (\r\n):

  1. Status line.
  2. Zero or more headers, each ending with a CRLF.
  3. Optional response body.

HTTP request

An HTTP request is made up of three parts, each separated by a CRLF (\r\n):

  1. Request line.
  2. Zero or more headers, each ending with a CRLF.
  3. 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