6.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.

Common HTTP Requests

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

HTTP Request

Description

GET

Retrieves information from the internet (ie. getting information from Wikipedia)

POST

Sends data to the internet (ie. submitting a form)

PUT

Replaces all representations of target resources with the uploaded content

DELETE

Deletes all representations of target resources

There are much more HTTP requests like HEAD, CONNECT, OPTIONS, etc, but the 4 above should suffice for most use cases in networking.

HTTP Responses

Each HTTP request is followed by a response to the sender. In the case of a GET request to Wikipedia, this response would contain the page we were looking for. The response to a POST request 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.

Last updated