Good day ardent readers, I'm sure it has crossed your mind at one point in time or another as to how exactly the Internet and World Wide Web works. Well, you're in luck :-)
Before we get started though, let's try to understand what the Web actually is
According to Wikipedia:
World Wide Web is a global collection of documents and other resources, linked by hyperlinks and URIs. Web resources are accessed using HTTP or HTTPS, which are application-level Internet protocols that use the Internet's transport protocols.[15]
Whoops, that's a lot...
So basically, the W3 is a branch of the Internet containing loads of interlinked resources (media, text etc.) which can be looked up through the use of a web browser
The workings of the W3
Now that we have a glimpse of what the web actually is, let's take a look at some of it's inner workings. For the web to function, 2 critical infrastructure are required to be present. These are:
- Client
- Server
A client is basically a workstation or software program that is capable of retrieving information from a server. They include web browsers, mobile phones, desktop computers etc.
On the other hand, a server is a computer program or device that serves a service (pun intended) to another program or device, known as a client. A web server could store images, html documents, **stylesheets, scripts etc. It is connected to the internet and could be accessed by a domain name
Connecting to the Server
For a client to connect to a web server, it needs to know it's IP address (basically an identifier for the a specific device on a network). To discover your IP address on Windows, you could run ipconfig
on the Command prompt or ifconfig
if you're on the Linux terminal
Visiting your first web page
To access a web page (example.org/home.html) hosted at some web server, your web browser resolves the server name of the URL into an IP address (since computers understand only 0s and 1s) using the Domain Name System. The browser then requests the page on a specific port
A sample HTTP request may look like:
GET /home.html HTTP/2
Host: example.org
The computer receiving the request then forwards it to the service listening on the appropriate port (80 in this case) and a response is sent back as so:
HTTP/2 200 OK
Content-Type: text/html; charset=UTF-8
This is also followed by the content of the requested resource.
Taking a closer look at what's happening:
The client sends a GET request to a server at example.org requesting for a specific page (/home.html) then the server responds back with a 200 OK
message which is a status code indicating that the request was successful. It also returns the content type and character set used
In future blogs, we could take a look at what makes up a URL (Uniform Resource Locator), the protocol scheme, top-level domain, subdirectories etc.
I hope this at least gives you a brief overview of how the web works. Till next time, stay safe!