• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

HTTP? ? The Web's Unsung Hero Explained

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
? A Bit of History — Where HTTP Came From


Back in 1989, Tim Berners-Lee invented the World Wide Web (WWW). But it wasn’t just websites — it was a system of protocols, and one of them was HTTP: the HyperText Transfer Protocol.

HTTP was designed as a simple way to send hypertext (HTML) documents between computers. This allowed the user to experience a more dynamic and interactive way to access information.

Since then, HTTP has evolved (currently at HTTP/3), but its core idea hasn’t changed:


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



"Let the client ask, and let the server answer."
That basic principle powers nearly every web app today. Without HTTP, the internet would not look, feel, or behave as it does.

? Request vs response:

? What Is an HTTP Request and Response?


When your browser opens a website, it sends an HTTP request.

The server replies with an HTTP response.

? Request Structure


An HTTP request typically includes:

  • Start line: Method (GET, POST, PUT, DELETE), path, protocol version
  • Headers: Info like content type, length, user-agent, tokens.
  • Body: Optional — used in methods like POST or PUT to send information to the server.
? Response Structure


A server sends back:

  • Start line: Protocol version + status code like so:
1xx - Informational

2xx – Success

3xx – Redirection

4xx – Client Error

5xx – Server Error
  • Headers: Metadata like content-type, caching rules
  • Body: Often contains the HTML or JSON payload

? Request vs Response diagram:


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



? Example: Making an HTTP Request in TypeScript


Let’s say we want to send a POST request with JSON to an API:


async function sendData() {
const response = await fetch("

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "Miguel", email: "miguel@example.com" }),
});

if (!response.ok) {
console.error("Request failed with status:", response.status);
return;
}

const data = await response.json();
console.log("Response data:", data);
}

As we can see the fetch sent a Post Request:


{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "Miguel", email: "miguel@example.com" }),
}

This includes, of course the three main parts of a HTTP request.

? TCP/IP Model (Where’s HTTP?)



Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



HTTP sits at the Application layer of the TCP/IP model:

Application ← HTTP lives here ?
Transport ← TCP handles the delivery ?
Internet ← IP takes care of addresses ?
Link ← Ethernet/WiFi physically connects ⚡

Key Things to Keep in Mind:


HTTP is a stateless protocol.

  • Each request is independent. The server doesn’t remember the last thing you asked.
  • The connection is not bidirectional meaning the server cannot send request by himself to the client.
  • If you want persistent connections, you need tools like WebSockets, which are also another type of protocol we use daily, like in videogames, videocalls or chats.

? Final Thoughts
HTTP may feel invisible, but it’s everywhere. It silently handles the exchange of information between browser and server.

? References


? If you found this article interesting or want to get in touch, I’m active on X

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.




Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу