HTTP: Request Messages
HTTP request messages are a pivotal part of the protocol. Let's have a close look at them!
Introduction
There are two types of HTTP messages as discussed previously:
- HTTP request messages
- HTTP response messages
We’ll study request messages in this one.
HTTP Request Messages
Let’s look at request messages first. Here is an example of a typical HTTP message:
Press + to interact
GET /path/to/file/index.html HTTP/1.1Host: www.educative.ioConnection: closeUser-agent: Mozilla/5.0Accept-language: frAccept: text/html
It should be noted that,
- HTTP messages are in plain ASCII text
- Each line of the message ends with two control characters: a carriage return and a line feed:
\r\n
.- The last line of the message also ends with a carriage return and a line feed!
- This particular message has 6 lines, but HTTP messages can have one or as many lines as needed.
- The first line is called the request line while the rest are called header lines.
The Anatomy of an HTTP Request Line
The HTTP request line is followed by an HTTP header. We’ll look at the request line first. The request line ...
Access this course and 1400+ top-rated courses and projects.