What is the protocol?
- Protocol is the agreement on how to send and receive and understand the information.
- Example: in past times, people asked help from each other by switching on the fires on top of mountains.
What is the HTTP?
HTTP (hypertext transfer protocol) — is a communication protocol (application layer) which transports messages over internet between client and server. It is the request-response protocol.
- Includes a set of rules for formatting and processing data.
- Designed for communication between web browsers as client and web servers as a server. HTTP request sent to a URL by client and servers sends back HTTP response.
- HTTP is a network protocol used to deliver resources which could be files on the World Wide Web, whether they are HTML files, image files, query results, scripts, or other file types.
- HTTP is over TCP and IP, SOAP is over HTTP
- TCP is used in applications where reliability is more important, such as file transfer, emails, and web browsing.
- UDP is used in applications where speed is more important such as video conferencing, live streaming, and online gaming.
- HTTP is request/response protocol. Client can make a request using
HTTP methods, server returns a response with HTTP status code.
- HTTP request contains → Request method, request body (payload), http header.
- HTTP response contains → Status code, response body (payload), http header.
netcat example

Request and response
- Request consists of:
- Method, URI, HTTP-version
- Headers
- Request message body
- Response consists of:
- Status line (HTTP-version, response code, response code small description = reason phrase)
- Headers
- Response message body
- Message body = HTTP message may have a body of data sent after the header lines.
- In a response, this is where the requested resource is returned to the client (the most common use of the message body), or perhaps explanatory text if there's an error.
- In a request, this is where user-entered data or uploaded files are sent to the server.
- If an HTTP message includes a body, there are usually header lines in the message that describe the body. In particular,
- The Content-Type: header gives the MIME-type of the data in the body(text/html, application/json, text/plain, text/css, image/gif). The Content-Length: header gives the number of bytes in the body.
URL=location, URN=name, URI=type of resource
-
URL is a specific type of URI that specifies the location of a resource on the internet. Includes schema (http, https), domain name, and path to resource.
