In HTTP 1.1, a minimal HTTP request consists of a request line and a Host
header:
GET /search HTTP/1.1 \r\n
Host: google.com \r\n
\r\n
The first line has this format:
Method Request-URI HTTP-Version CRLF
Method
should be a valid HTTP method; one of [1][2]:
OPTIONS
GET
HEAD
POST
PUT
DELETE
PATCH
TRACE
CONNECT
Request-URI
indicates either the URI or the path to the resource that the client is requesting. It can be either:
Host
headerHTTP-Version
indicates the version of the HTTP protocol the client is using. For HTTP 1.1 requests this must always be HTTP/1.1
.
The request line ends with a carriage return—line feed pair, usually represented by \r\n
.