8.1 HTTP Overview
HTTP is a very common protocol used to transmit data over the Internet. It defines the format of messages and the actions that should be completed for those types of messages. While the messaging implementation can get very complicated, HTTP protocols make the task much easier for us to complete.
To receive or send data, we make HTTP requests. Here are some of the more commonly used HTTP requests that you may want to use
There are much more HTTP requests like HEAD, CONNECT, OPTIONS, etc, but the 4 above should suffice for most use cases in networking.
Each HTTP request is followed by a response to the sender. In the case of a
GETrequest to Wikipedia, this response would contain the page we were looking for. The response to a
POSTrequest would confirm that the site received the data properly (given that the request was correctly formatted and had the proper permission), and possibly contain other information.
HTTP requests are composed of two main parts: the header and the body. The header contains information about the request and request body. For example, it will specify the type of the request, timestamps from when it was sent, and (often) authorization tokens. The body contains the content of the request. This is usually where all of the data we want to send or receive will go.