From f2397729bfad4edae55fd38d1b088df04a3ae82b Mon Sep 17 00:00:00 2001 From: Zaira <33151350+zairahira@users.noreply.github.com> Date: Sun, 25 Jan 2026 22:11:11 +0500 Subject: [PATCH] feat(curriculum): add Understanding how HTTP, DNS and TCP/IP lesson block (#65154) Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com> Co-authored-by: Kolade Chris <65571316+Ksound22@users.noreply.github.com> --- client/i18n/locales/english/intro.json | 6 + .../index.md | 9 + .../69661c7d084c85542e76a597.md | 187 ++++++++++++ .../69661d1a74e9aa63cb171957.md | 177 ++++++++++++ .../69661d1d78d88af238dee253.md | 267 ++++++++++++++++++ .../69661d2fc36411aa9e25ea64.md | 180 ++++++++++++ ...understanding-how-http-dns-tcpip-work.json | 26 ++ .../back-end-development-and-apis-v9.json | 5 +- 8 files changed, 856 insertions(+), 1 deletion(-) create mode 100644 client/src/pages/learn/back-end-development-and-apis/lecture-understanding-how-http-dns-tcpip-work/index.md create mode 100644 curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661c7d084c85542e76a597.md create mode 100644 curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1a74e9aa63cb171957.md create mode 100644 curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1d78d88af238dee253.md create mode 100644 curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d2fc36411aa9e25ea64.md create mode 100644 curriculum/structure/blocks/lecture-understanding-how-http-dns-tcpip-work.json diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 49d6de00c3a..769cd1fe435 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -7734,6 +7734,12 @@ "Learn about the node.js core modules, such as fs, buffer, stream, path modules, and more, so you can understand what Node gives you out of the box to build efficient applications without relying on third-party libraries." ] }, + "lecture-understanding-how-http-dns-tcpip-work": { + "title": "Understanding how HTTP, DNS and TCP/IP work", + "intro": [ + "Learn the fundamental concepts of how the internet works, focusing on HTTP, DNS, and TCP/IP." + ] + }, "lecture-understanding-the-http-request-response-model": { "title": "Understanding the HTTP Request-Response Model", "intro": [ diff --git a/client/src/pages/learn/back-end-development-and-apis/lecture-understanding-how-http-dns-tcpip-work/index.md b/client/src/pages/learn/back-end-development-and-apis/lecture-understanding-how-http-dns-tcpip-work/index.md new file mode 100644 index 00000000000..bc7c6684cd0 --- /dev/null +++ b/client/src/pages/learn/back-end-development-and-apis/lecture-understanding-how-http-dns-tcpip-work/index.md @@ -0,0 +1,9 @@ +--- +title: Introduction to the Understanding how HTTP, DNS and TCP/IP work +block: lecture-understanding-how-http-dns-tcpip-work +superBlock: back-end-development-and-apis +--- + +## Introduction to the Understanding how HTTP, DNS and TCP/IP work + +Learn the fundamental concepts of how the internet works, focusing on HTTP, DNS, and TCP/IP. diff --git a/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661c7d084c85542e76a597.md b/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661c7d084c85542e76a597.md new file mode 100644 index 00000000000..88e9d286ab7 --- /dev/null +++ b/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661c7d084c85542e76a597.md @@ -0,0 +1,187 @@ +--- +id: 69661c7d084c85542e76a597 +title: What is a Server and How Does it Work on a Higher Level? +challengeType: 19 +dashedName: what-is-a-server-and-how-does-it-work-on-a-higher-level +--- + +# --description-- + +Servers are essential for the modern web. They power the online experiences that we rely on every day as users, and they will power most of the experiences that you will create as a developer. + +Let’s learn more about them. + +As you may know, the internet is a global system of interconnected computer networks. Servers are the central components that enable this communication by handling the process of exchanging data. + +A **server** is a computer or computer program that receives requests from other computers and sends data or services to them over the network as a response. + +Server is a dual concept because it can refer to: + +* The actual physical, powerful computer **hardware** that is designed to run efficiently and continuously to provide these services. These machines are built and designed for reliability. + +* Or to the actual computer **software** that is running on that physical hardware to provide the services. + +The physical computers that we refer to as “servers” are usually stored at data centers, which are large and secure facilities with controlled environments. + +Servers are an essential part of **The Client-Server Model**. + +The Client-Server Model is a distributed system architecture where components are either clients or servers. + +* The **client** is the process or application that sends requests to servers for data or services. For example, a web browser. + +* The **server** is the physical device or computer program that handles those requests and returns a response. + +Essentially, the client and the server are part of a request-response cycle, where the client sends a request to the server, and the server returns a response to the client. + +For example, when you use your browser (the client) to authenticate on an application with your username and password, your information is securely sent to a server. The server then checks if the username and password that you entered match the information that the platform currently has in its database. If there is a match, the server returns a successful response to the client (your browser), and you are successfully authenticated on the site. + +If no match is found, the server returns a failure response to the client, and you’ll typically see an error or some sort of feedback explaining why your login attempt was unsuccessful. + +All of this authentication logic runs on the server. The server is responsible for validating credentials, interacting with the database, and deciding how to respond to each request. + +Each server response includes an HTTP status code, which tells the client what happened. These status codes let the client know whether a request succeeded or failed and why. + +For example: + +* 200 means that everything was OK. + +* 404 means that the resource was not found on the server. + +* 500 means that there was an internal server error. + +* 503 means that the server is temporarily unavailable. + +* And so on… + + +Each status code has its own unique meaning. + +Examples of real-world applications that use servers include e-commerce, search engines, gaming, video streaming, cloud storage and collaboration platforms, social media platforms, financial applications, and more. + +If the data is updated dynamically or the application needs some sort of communication with a database, servers are very likely key components of the communication process. + +These are some of the main types of servers: + +* **Web servers** deliver web content, such as HTML pages, images, and CSS files, to browsers. + +* **Application servers** handle business logic, process user input, and coordinate responses. + +* **Database servers** run database management systems and store, retrieve, and manage data. + +* **Mail servers** send, receive, and store email messages. + +* **File servers** manage access to files and allow them to be stored and shared across a network. + +* **Proxy servers** act as intermediaries between clients and other servers, often used for caching, security, or traffic control. + +Servers are the backbone of the powerful online platforms we use every day. They make it possible to run complex logic, store and process large amounts of data, and support millions of users at the same time. Without servers, the modern digital world we rely on would not exist. + +# --questions-- + +## --text-- + +Which of the following statements best defines the dual concept of a server? + +## --answers-- + +A server is always a massive supercomputer used only by organizations. + +### --feedback-- + +Think about what is running the service and what the service itself is. + +--- + +A server is exclusively the software application that delivers services, never the physical machine. + +### --feedback-- + +Think about what is running the service and what the service itself is. + +--- + +A server refers to both the dedicated physical computer hardware and the specialized software program that provides services. + +--- + +A server is the connection cable that links clients to the internet network. + +### --feedback-- + +Think about what is running the service and what the service itself is. + +## --video-solution-- + +3 + +## --text-- + +In the Client-Server Model, what is the server's primary function in the Request-Response Cycle? + +## --answers-- + +To act as the client's firewall, blocking all incoming traffic. + +### --feedback-- + +Think about the relationship in the cycle: who asks for something, and who is responsible for providing it? + +--- + +To generate the initial request that starts the communication process. + +### --feedback-- + +Think about the relationship in the cycle: who asks for something, and who is responsible for providing it? + +--- + +To process the client's request, execute the necessary logic (like querying a database), and return the requested data. + +--- + +To convert the data from analog signals to digital signals. + +### --feedback-- + +Think about the relationship in the cycle: who asks for something, and who is responsible for providing it? + +## --video-solution-- + +3 + +## --text-- + +Which status code is returned by a server when the requested resource cannot be found? + +## --answers-- + +200 + +### --feedback-- + +This code belongs to the 4xx family. + +--- + +404 + +--- + +301 + +### --feedback-- + +This code belongs to the 4xx family. + +--- + +500 + +### --feedback-- + +This code belongs to the 4xx family. + +## --video-solution-- + +2 diff --git a/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1a74e9aa63cb171957.md b/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1a74e9aa63cb171957.md new file mode 100644 index 00000000000..e8dabbbaabb --- /dev/null +++ b/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1a74e9aa63cb171957.md @@ -0,0 +1,177 @@ +--- +id: 69661d1a74e9aa63cb171957 +title: What is DNS and How Does it Work at a High Level? +challengeType: 19 +dashedName: what-is-dns-and-how-does-it-work-at-a-high-level +--- + +# --description-- + +When you visit a website, the first thing you do is type in a web address in your browser. + +For example, to go to freeCodeCamp, you would enter `freecodecamp.org` in your browser’s address bar. + +This is known as a domain name. It’s a unique human-readable identifier for that resource on the internet. + +Domain names are very closely related to the concept of DNS, which is the main topic of this lesson. Let’s start by talking a little bit about the domain name hierarchy, so you can understand how a DNS works behind the scenes. + +The domain name hierarchy is read from right to left, moving from the most general category to the most specific one. + +The main structure of a domain name is, from right to left: + +* **Top-Level Domain (TLD):** the last segment of the domain name, located to the right. In the case of `freecodecamp.org`, that would be `.org`. Other examples include `.com` and `.edu`. + +* **Second-Level Domain (SLD):** the name registered by the person or organization. That would be `freecodecamp` in `freecodecamp.org`. This is what you usually notice first when you see a web address. + +* **Third-Level Domain (Subdomain):** used to identify a specific section of the main domain. For example, `www`, which stands for “World Wide Web.” Nowadays, modern web servers automatically handle domain routing, so you can access a website with or without entering `www`. Other examples of subdomains include `blog.`, `shop.`, `support.`, and `api.`. + + +Domain names are very helpful to us as humans because they’re easy to remember and type into a browser. However, as you know, computers work with numbers. Your browser has to transform the domain name that you entered into something known as an IP address to find the website you are looking for. + +An **IP address** is a unique sequence of numbers that identifies a computer on a network, such as the internet. + +IP addresses are essential for allowing clients to send requests to the correct servers and get the appropriate responses. An example of an IPv4 address is `127.0.0.1`. The equivalent IP address in a newer standard called IPv6 would be `0:0:0:0:0:0:0:1`. + +There is a lot to learn about IP addresses, and you might want to explore them in more depth as you continue learning. But for now, you just need to understand that they are the unique numerical addresses used to identify computers on a network. + +From the concepts of domain names and IP addresses, now we can reach the concept of DNS. + +DNS stands for **Domain Name System**. This is usually referred to as the “phone book” of the internet. + +The DNS translates the domain name that you write on your browser to its corresponding IP address. It’s a hierarchical and decentralized naming system for computers and devices that are connected to the internet or a specific network. + +When the user enters a domain name in the browser, such as `freecodecamp.org`, the DNS maps that name to the IP address of its corresponding server. Once the server has been identified, the client’s request is sent to the server. The server handles that request based on how it was programmed, and it finally sends a response to the client. This completes the request-response cycle. + +This is all possible thanks to the DNS that performed that initial conversion to the target IP address. + +Let’s dive into the details of the DNS resolution process. + +## The DNS Resolution Process + +* DNS resolution works by sending a query through a chain of DNS servers. + +* When you (the user) enter a domain name on the browser, the **client** sends a request to a local DNS server. This local DNS server is known as the **Recursive Resolver**. This is usually managed by your internet service provider (ISP). + +* The Recursive Resolver forwards that request to **Root Servers**. These are general servers that do not have direct information about IP addresses. They work by directing the Recursive Resolver to a more specific server, specifically to the Top-Level Domain (TLD) Server for the particular top-level domain of the request. For example, the server responsible for all `.org` domains. + +* The Recursive Resolver then queries the **Top-Level Domain (TLD) Server**. This server returns the address of the specific Authoritative Name Server that holds the records for the domain that was requested (for example, `freecodecamp.org`). + +* The Recursive Resolver starts a final query to the corresponding **Authoritative Name Server.** If the **DNS record** is found, it is returned to the Recursive Resolver. + +* When the Recursive Resolver receives the IP Address, it delivers it to the client, so you can start browsing the website. + +The Authoritative Name Server returns **DNS Records**, not just IP addresses. DNS Records are structured text entries that contain important information about a domain, such as subdomain information, how long the information should be cached, and information required to perform the service requested. + +To optimize the process, the Recursive Resolver caches the DNS Record temporarily to speed up the process. This way, you won’t be making the same request repeatedly in a short time period. That makes the overall process much more efficient. + +As you can see, DNS Servers are essential because they provide the initial, critical step of translating domain names into IP addresses. This translation process allows every client to locate and connect to the correct server. Without this directory system, the client-server model, the backbone of the modern web, would not be functional. + +# --questions-- + +## --text-- + +The Domain Name System (DNS) is frequently compared to which real-world service? + +## --answers-- + +A Library Catalog + +### --feedback-- + +The service it is compared to involves looking up a familiar name to find a corresponding numerical address. + +--- + +A Phone Book or Directory + +--- + +A Global Positioning System (GPS) + +### --feedback-- + +The service it is compared to involves looking up a familiar name to find a corresponding numerical address. + +--- + +A Barcode Scanner + +### --feedback-- + +The service it is compared to involves looking up a familiar name to find a corresponding numerical address. + +## --video-solution-- + +2 + +## --text-- + +What is the main problem that the Domain Name System (DNS) was invented to solve for internet users? + +## --answers-- + +To encrypt all communication between a client and a server for security. + +### --feedback-- + +Focus on the difference between how humans prefer to identify things (names) and how computers need to identify them (numbers). + +--- + +To compress website files so they load faster on slow connections. + +### --feedback-- + +Focus on the difference between how humans prefer to identify things (names) and how computers need to identify them (numbers). + +--- + +To host all website files and content on a single centralized server. + +### --feedback-- + +Focus on the difference between how humans prefer to identify things (names) and how computers need to identify them (numbers). + +--- + +To allow humans to use easy-to-remember domain names instead of complicated numerical IP addresses. + +## --video-solution-- + +4 + +## --text-- + +Which component in the DNS resolution process is responsible for performing the multiple iterative queries to find the final IP address? + +## --answers-- + +The Root Server + +### --feedback-- + +This component acts as an intermediary, taking the client's single request and traversing the server hierarchy. + +--- + +The TLD Server + +### --feedback-- + +This component acts as an intermediary, taking the client's single request and traversing the server hierarchy. + +--- + +The Recursive Resolver + +--- + +The Authoritative Name Server + +### --feedback-- + +This component acts as an intermediary, taking the client's single request and traversing the server hierarchy. + +## --video-solution-- + +3 diff --git a/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1d78d88af238dee253.md b/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1d78d88af238dee253.md new file mode 100644 index 00000000000..dcbe82f054e --- /dev/null +++ b/curriculum/challenges/english/blocks/lecture-understanding-how-http-dns-tcpip-work/69661d1d78d88af238dee253.md @@ -0,0 +1,267 @@ +--- +id: 69661d1d78d88af238dee253 +title: What are TCP/IP and HTTP and What is the Basic Syntax for HTTP? +challengeType: 19 +dashedName: what-are-tcp-ip-and-http-and-what-is-the-basic-syntax-for-http +--- + +# --description-- + +The digital world as we know it today is based on the notion that devices can communicate with each other, sending and receiving data as needed. + +But have you ever thought about how this process works behind the scenes? + +When you browse the internet, you constantly request and send data through the network. This is possible thanks to a detailed process based on standard rules and procedures that make sure that the information is sent and received correctly by the appropriate devices. + +That set of rules and procedures is known as a **protocol**. + +Protocols basically allow two or more devices to communicate with each other by making sure that they all follow certain standards, such as the format of the data that will be exchanged. + +Protocols make sure that all devices involved in the data exchange process will be able to understand each other. Figuratively, they will all know how to “speak the same language”. + +At their core, TCP/IP are the protocols that make the internet possible. + +**TCP/IP** is a suite of communication protocols that determine how data is packaged, sent, routed, and received through a network. It ensures that information is transported reliably. + +Specifically, the **IP**, where IP stands for **Internet Protocol**, is a protocol that makes sure that the data goes from the source to the correct destination in the network. + +Why is this important? Remember that the internet is a global network of interconnected devices. For your device to send a request, first it has to know where to send that data. That is the main purpose of IP addresses, the foundation of the Internet Protocol (IP). They uniquely identify the devices on the network, so the source device knows where to send the data. + +By itself, the Internet Protocol is connectionless, which means that each unit of data (called a “packet”) is sent independently to its destination across the network, without previously establishing a connection or ensuring that it will be delivered correctly or in the right order. If they do reach their destination, the source is not notified at all. + +This is where protocols like TCP become really important. + +The **TCP** protocol, known as the **Transmission Control Protocol**, breaks the data into small segments. These fundamental data units are numbered and reassembled when they reach their destination using specific algorithms that detect if the data is complete and correct. These algorithms also check for errors and lost packets, so they can ask the source to resend them if needed, making sure that the information is received correctly. + +Together, the Transmission Control Protocol and the Internet Protocol set the rules and standards needed to ensure that data is transmitted in a reliable way across the internet. + +In addition to TCP/IP, there is another very important protocol for modern internet: HTTP. + +HTTP works at the application level. + +**HTTP** stands for **HyperText Transfer Protocol**. It defines the rules and standards for the communication between the client (like your browser) and the server. + +When you try to access a website on your browser, the browser sends an HTTP request to the server asking for that specific resource and its related assets. The server receives the HTTP request, executes its logic, and returns an HTTP response to the client with the content requested or some information indicating why the request was not successful. + +HTTP requests and HTTP responses have very similar structures, including: + +* A request line (the start line) + +* Headers + +* Body (optional) + +## **HTTP Requests** + +The **request line** of an HTTP request is divided into three main parts: + +* A method, which describes the action that is being requested. For example, `GET` to retrieve data and `POST` to submit data. Other common methods include `PUT`, `PATCH`, `DELETE`, and `HEAD`. + +* A path or URI, which describes the specific resource that the client is requesting. + +* The version of the HTTP protocol being used for the communication process. For example, `HTTP/1.1`. + +This is an example with the `GET` method on the root `/` path and HTTP version 1.1: + +`GET / HTTP/1.1` + +The **header** contains key-value pairs with information about the request. + +For example: `Content-Type: application/json`. + +Below the header, there’s an empty line to indicate that the metadata (additional information about the request) is complete. + +And finally, the **body**. This is optional. It’s sent when the client has to send information to the server, like when submitting new data with the `POST` method. + +This is an example of an HTTP request: + +```md +GET / HTTP/1.1 +Host: example.com +User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) +Accept: text/html +Connection: keep-alive +``` + +## **HTTP responses** + +They have a very similar structure: + +* A status line + +* Header + +* Body + + +First, the **status line** contains information about the result of the request. You will usually find this: + +* The version of HTTP being used for the communication process. For example, `HTTP/1.1`. + +* The status code, which indicates the result of the request. + +* A reason phrase, a brief human-readable description of the status code. This is helpful to understand what happened. + + +Common status codes include: + +* `200 OK` + +* `201 CREATED` + +* `400 BAD REQUEST` + +* `404 NOT FOUND` + +* `403 FORBIDDEN` + +* `500 INTERNAL SERVER ERROR` + + +There are many status codes. They are categorized by their first digit from left to right. + +* `1xx` for informational responses. + +* `2xx` for successful responses. + +* `3xx` for redirection messages. + +* `4xx` for client error responses. + +* `5xx` for server error responses. + + +Below the status line of an HTTP response, we find the **header** with metadata about the response. For example, `Content-Type: text/html`. This may also include the content length, date, location, and additional information that the client may find helpful. + +And finally, we find the HTTP response **body**, which contains the data that the client was requesting or an explanation of what happened if the request was not successful. This is optional, but it’s included in most responses. + +This is an example of an HTTP response: + +```md +HTTP/1.1 200 OK +Content-Type: text/html +Content-Length: 105 +Connection: keep-alive + + + +