Files
cws/notes/http-request.md
2024-11-11 00:50:39 +01:00

26 lines
540 B
Markdown

# HTTP Request
This is an example of a basic HTTP request made from the browser:
```bash
GET / HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.tutorialspoint.com
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
```
The first line is a *request line*. It has:
- Method (GET, POST, HEAD, ...)
- Location (the request resource, file)
- HTTP version
# HTTP Response
```bash
HTTP/1.1 200 OK\r\n
Content-Type: text/html\r\n
Content-Length: 88\r\n
Connection: Closed\r\n
\r\n
<HTML>
```