Today is like any other normal day—you visit your favorite website to check out some new content or accomplish a task. The information appears on your page instantly, as if by magic. But have you ever wondered where that data came from and how it got there? How did the website know what data to load for you? Who did it ask for that data? Or, more importantly, how did it ask for that data? These are all questions that slip through the cracks when we browse websites, but looking under the hood reveals a complex messaging system that is extremely interesting. This system, in part, is known as HTTP.
HTTP, short for Hypertext Transfer Protocol, is a request-response protocol that serves as the foundation of data exchange and communication within the client-server computing model. What this means in simpler terms is that HTTP helps facilitate the exchange of information between a client (i.e. website, mobile app, etc.) and a server.
At a base level, the operation of HTTP can be explained quite simply in the following steps detailing the request-response paradigm between a client and a server:
1) The client submits an HTTP request message to the server. 2) The server receives the HTTP request, performs some functions on behalf of the client according to the request. 3) The server returns a response message to the client containing important information about the processing of the request.
These three steps serve as the basis of communication via HTTP, enabling us to build and use complex web-based systems that are commonplace on the Internet today.
Go to your favorite website and open the developer console. Open the “Network” tab and refresh the page. Browse through the HTTP requests that go into building the web page. Try to define some of the common types of data that are transported via HTTP for this page.
What are some types of data received via HTTP requests?
There can be quite a lot of HTTP requests involved in building a webpage. A visit to Codecademy reveals a few common types of data that you may find loaded on other websites. These include:
- Images (PNG, JPG, GIF, etc.)
- Data (XHR requests)