diff --git a/_drafts/Article/Translation/mediocre-engineers-guide-to-https.md b/_drafts/Article/Translation/mediocre-engineers-guide-to-https.md
index 994aabf..a15c2ef 100644
--- a/_drafts/Article/Translation/mediocre-engineers-guide-to-https.md
+++ b/_drafts/Article/Translation/mediocre-engineers-guide-to-https.md
@@ -1,5 +1,5 @@
---
-title: Mediocre Engineer’s guide to HTTPS
+title: 平庸工程师的HTTPS指南
date: 2024-05-28T04:38:43.572Z
authorURL: ""
originalURL: https://devonperoutky.super.site/blog-posts/mediocre-engineers-guide-to-https
@@ -7,218 +7,139 @@ translator: ""
reviewer: ""
---
-
-
-
-
-- [
-
- Lifecycle of a HTTP request
-
- ][1]
-- [
-
- 1\. Sender Makes a Request
-
- ][2]
-- [
-
- 2\. DNS Lookup:
-
- ][3]
-- [
-
- 3\. TCP Handshake:
-
- ][4]
-- [
-
- 4\. Transmit HTTP Request
-
- ][5]
-- [
-
- 5\. Packets routed across Internet to Server
-
- ][6]
-- [
-
- Step-by-step explanation of how text makes it across the internet
-
- ][7]
-- [
-
- 6\. Server Response
-
- ][8]
-- [
-
- 7\. Content Rendering:
-
- ][9]
-- [
-
- Little Layer Review
-
- ][10]
-- [
-
- HTTPS = HTTP + Encryption
-
- ][11]
-- [
-
- TLS Handshake
-
- ][12]
-- [
-
- TLS Handshake
-
- ][13]
-- [
-
- Everything you’ve learned here is a lie.
-
- ][14]
-- [
-
- What is different about a handshake in TLS 1.3?
-
- ][15]
-- [
-
- Shameful Plug
-
- ][16]
-
-As a mediocre engineer, I took Internet and HTTPS communication for granted and never dove any deeper. Today we’re improving as engineers and learning a rough overview of how internet communication works, specifically focusing on HTTP and TLS.
-
-The Internet is “just” a network of interconnected computer networks. The term "Internet" literally means "between networks." It operates as a packet-switched [mesh network][17] with best-effort delivery, meaning there are no guarantees on whether a packet will be delivered or how long it will take. The reason why the internet appears to operate so smoothly (at least from a technical perspective) is the layers of abstraction that handle retries, ordering, deduplication, security and so many other things behind the scenes. Letting us developers just focus on the application layer (aka. Writing HTTP requests from San Francisco for $300K/year).
-
-Each layer provides certain functionalities, which can be fulfilled by different [protocols][18]. Such modularization makes it possible to replace the protocol on one layer without affecting the protocols on the other layers.
-
-Here’s a simple table of the layers.
-
-
-
-We’ll go over these layers more in-depth layer, but first, let’s see this in action.
-
-# Lifecycle of a HTTP request
-
-Here is the path of an HTTP request through these layers (Skipping physical layer for brevity).
-
-
-
-## **1\. Sender Makes a Request**
-
-The process begins at the Application layer, where the client (usually a web browser) constructs an HTTP request. HTTP is a text-based protocol, meaning that all this data is sent as plain text over the wire.
-
-The first line typically includes:
-
-- **HTTP method** (GET, POST, etc)
-- **Requested Resource** (Example: `/index.html` )
-- **Protocol version.**
-
-The remainder of the HTTP message contains headers in a `key: value` format an an optional message body.
-
-**Example: HTTP Request**
-
-Copy
-```
-GET /index.html HTTP/1.1
-Host: www.example.com
-Accept: text/html
-User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
-```
-## **2\. DNS Lookup**:
+- [HTTP 请求的生命周期](#http请求的生命周期)
+ - [1. 发送方发起请求](#1-发送方发起请求)
+ - [2. DNS 查询](#2-dns查询)
+ - [3. TCP 握手](#3-tcp握手)
+ - [4. 传输 HTTP 请求](#4-传输http请求)
+ - [5. 数据包通过互联网路由到服务器](#5-数据包通过互联网路由到服务器)
+ - [文本如何穿越互联网的逐步解释](#文本如何穿越互联网的逐步解释)
+ - [6. 服务器响应](#6-服务器响应)
+ - [**7. 内容渲染**:](#7-内容渲染)
+- [层级简要回顾](#层级简要回顾)
+- [HTTPS = HTTP + 加密](#https--http--加密)
+- [TLS 握手](#tls握手)
+ - [TLS 握手](#tls握手-1)
+- [**你在这里学到的一切都是谎言。**](#你在这里学到的一切都是谎言)
+- [**TLS 1.3 中的握手有什么不同?**](#tls-13中的握手有什么不同)
+- [不要脸的广告](#不要脸的广告)
-The Domain Name System (DNS) translates the human-readable domain name (`**www.example.com**`) into an IP address (e.g., `**93.184.216.34**`). The client queries DNS servers to resolve the domain name to its corresponding IP address. This process goes through multiple resolvers until it reaches the authoritative server which does the conversion of domain name to IP address. At a very high level, the three components are
+作为一名平庸的工程师,我一直把互联网和 HTTPS 通信视为理所当然,从未深入研究过。今天,我们将作为工程师进步,学习互联网通信工作原理的大致概述,特别关注 HTTP 和 TLS。
-- **Stub resolvers**, which lives on the client machine and routes the request to the appropriate recursive resolver (explained next)
-- **Recursive resolvers**, which receives requests from the stub resolver and queries authoritative servers to resolve the domain name - often caching the result. Your Internet Service Provider (ISP) typically provides a recursive resolver, or you may use a public one like Google DNS (8.8.8.8).
-- **Authoritative servers** which contain the actual DNS records (like A, MX, CNAME, etc.) for a domain and responds to queries with the information in those records. Authoritative servers are the final source of truth for domain name data.
+互联网"只是"相互连接的计算机网络的网络。"互联网"一词字面意思是"网络之间"。它作为一个分组交换的[网状网络][6]运行,采用尽力而为的交付方式,这意味着对于数据包是否会被传递或需要多长时间没有任何保证。互联网之所以看起来运行如此顺畅(至少从技术角度看),是因为抽象层处理了重试、排序、去重、安全性和许多其他幕后工作。让我们开发人员只需专注于应用层(也就是在旧金山写 HTTP 请求,年薪 30 万美元)。
-When a client issues a request for a resource using a domain name, the **stub resolver** on your computer sends a query to a recursive resolver to resolve the domain name.
+每一层提供特定功能,可以由不同的[协议][7]实现。这种模块化使得可以替换一层上的协议而不影响其他层上的协议。
-The recursive resolver, queries authoritative DNS servers as needed to resolve the domain name to an IP address.
+这里是各层的简单表格。
-## **3\. TCP Handshake**:
+我们稍后会更深入地讨论这些层,但首先,让我们看看它们的实际运作。
-Now that we have the IP address of the server, the client can begin transmitting the HTTP and we move to the Transport Layer. There are two primary protocols for the transport layer, **TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).**
+## HTTP 请求的生命周期
-💡
+以下是 HTTP 请求通过这些层的路径(为简洁起见跳过物理层)。
+
+![图片2: 图片][2]
+
+### 1. 发送方发起请求
+
+这个过程从应用层开始,客户端(通常是网络浏览器)构建一个 HTTP 请求。HTTP 是一种基于文本的协议,这意味着所有数据都以纯文本形式通过网络发送。
+
+第一行通常包括:
+
+* **HTTP 方法**(GET、POST 等)
+* **请求的资源**(例如:`/index.html`)
+* **协议版本**。
+
+HTTP 消息的其余部分包含`键: 值`格式的头部和一个可选的消息体。
-TCP is a connection-oriented protocol that ensures reliable, ordered, and error-checked data delivery between applications.
+**示例:HTTP 请求**
-UDP is a connectionless protocol that provides fast, low-overhead data transmission without guaranteeing delivery, order, or error checking.
+```bash
+GET /index.html HTTP/1.1
+Host: www.example.com
+Accept: text/html
+User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
+```
-As of 2024, TCP is the main protocol for managing data transport across the internet, while UDP is less commonly used, typically for real-time applications like streaming or video calls, where low latency is crucial and occasional packet loss is acceptable. Now back to the topic at all.
+### 2. DNS 查询
-Once the client has obtained a the IP address, it initiates a TCP connection with the server on port 80 (the standard port for HTTP). This involves a three-step handshake:
+域名系统(DNS)将人类可读的域名(`**www.example.com**`)转换为 IP 地址(例如,`**93.184.216.34**`)。客户端查询 DNS 服务器以将域名解析为其对应的 IP 地址。这个过程通过多个解析器,直到到达权威服务器,后者完成域名到 IP 地址的转换。在非常高的层面上,三个组件是:
-- **SYN**: The client sends a SYN (synchronize) packet to the server to request a connection.
-- **SYN-ACK**: The server responds with a SYN-ACK (synchronize-acknowledge) packet to acknowledge the request.
-- **ACK**: The client sends an ACK (acknowledge) packet back to the server, establishing a reliable connection.
+* **存根解析器**,位于客户端机器上,将请求路由到适当的递归解析器(下面解释)
+* **递归解析器**,接收来自存根解析器的请求并查询权威服务器以解析域名 - 通常会缓存结果。您的互联网服务提供商(ISP)通常提供递归解析器,或者您可能使用公共解析器,如 Google DNS(8.8.8.8)。
+* **权威服务器**,包含域的实际 DNS 记录(如 A、MX、CNAME 等),并用这些记录中的信息响应查询。权威服务器是域名数据的最终真相来源。
-## 4\. Transmit HTTP Request
+当客户端使用域名请求资源时,计算机上的**存根解析器**向递归解析器发送查询以解析域名。
-With the TCP connection in place, the client sends the actual HTTP request. As mentioned, HTTP is a text-based protocol, so the request headers and the body (if any) are sent as plain text.
+递归解析器根据需要查询权威 DNS 服务器,将域名解析为 IP 地址。
-## 5\. Packets routed across Internet to Server
+### 3. TCP 握手
-**⚠️⚠️⚠️⚠️⚠️ We’re going deep here ⚠️⚠️⚠️⚠️⚠️**
+现在我们有了服务器的 IP 地址,客户端可以开始传输 HTTP,我们进入传输层。传输层有两个主要协议,**TCP(传输控制协议)和 UDP(用户数据报协议)**。
-When a client sends a request, the data packets don't travel directly to the server. Instead, they follow a path through various network devices, primarily routers, which determine the best route for the packets to reach the server network gateway. From there, the link layer comes into play.
+💡
-### Step-by-step explanation of how text makes it across the internet
+TCP 是一种面向连接的协议,确保应用程序之间可靠、有序和经过错误检查的数据传输。
-1. **Initial Transmission**:
+UDP 是一种无连接协议,提供快速、低开销的数据传输,但不保证传输、顺序或错误检查。
-The client's device encapsulates the HTTP request data into TCP segments and then into IP packets. These packets are further encapsulated into smaller chunks, referred to as frames, suitable for the Link Layer (e.g., Ethernet frames if using a wired connection).
+截至 2024 年,TCP 是互联网上管理数据传输的主要协议,而 UDP 使用较少,通常用于实时应用,如流媒体或视频通话,其中低延迟至关重要,偶尔的数据包丢失是可接受的。现在回到主题。
-3. **Local Network**:
+一旦客户端获得 IP 地址,它就会在端口 80(HTTP 的标准端口)上与服务器建立 TCP 连接。这涉及三步握手:
-The frames are transmitted over the local network to the client's router. The Link Layer handles the communication within this local network, ensuring the frames reach the router.
+* **SYN**:客户端向服务器发送 SYN(同步)数据包请求连接。
+* **SYN-ACK**:服务器以 SYN-ACK(同步-确认)数据包响应,确认请求。
+* **ACK**:客户端向服务器发回 ACK(确认)数据包,建立可靠连接。
-5. **Local Router Processing**:
+### 4. 传输 HTTP 请求
-The router receives the frames, strips off the Link Layer headers, and processes the IP packets. The router examines the destination IP address in the packets and determines the next hop on the path to the server.
+建立 TCP 连接后,客户端发送实际的 HTTP 请求。如前所述,HTTP 是基于文本的协议,因此请求头和正文(如果有)以纯文本形式发送。
-7. **Routing Across Networks**:
+### 5. 数据包通过互联网路由到服务器
-The router forwards the packets to the next network, often through one or more intermediary routers. Each intermediary router repeats the process: receiving the packets, determining thenext hop, and forwarding them.
+**⚠️⚠️⚠️⚠️⚠️ 我们要深入了 ⚠️⚠️⚠️⚠️⚠️**
-9. **Final Network**
+当客户端发送请求时,数据包不会直接传输到服务器。相反,它们通过各种网络设备(主要是路由器)遵循路径,这些设备确定数据包到达服务器网络网关的最佳路线。从那里,链路层开始发挥作用。
-Eventually, the packets reach a router on the same network as the destination server. This router performs the final routing decision and sends the packets to the appropriate local device (the server).
+### 文本如何穿越互联网的逐步解释
-11. **Server Reception**:
+1. **初始传输**:
+客户端设备将 HTTP 请求数据封装到 TCP 段中,然后封装到 IP 数据包中。这些数据包进一步封装成更小的块,称为帧,适合链路层(例如,如果使用有线连接,则为以太网帧)。
-The server's router forwards the packets over the local network segment to the server. The Link Layer ensures the frames are correctly transmitted to the server's network interface. (It has been doing that for every machine → machine communication for this whole time.
+3. **本地网络**:
+帧通过本地网络传输到客户端的路由器。链路层处理这个本地网络内的通信,确保帧到达路由器。
-13. **Server Processing**:
+5. **本地路由器处理**:
+路由器接收帧,剥离链路层头部,并处理 IP 数据包。路由器检查数据包中的目标 IP 地址,并确定通往服务器的路径上的下一跳。
-The server receives the frames, extracts the IP packets, and processes the encapsulated TCP segments to reconstruct the original HTTP request. The server then generates an HTTP response and the process reverses to send the response back to the client.
+7. **跨网络路由**:
+路由器将数据包转发到下一个网络,通常通过一个或多个中间路由器。每个中间路由器重复这个过程:接收数据包,确定下一跳,并转发它们。
-⁉️
+9. **最终网络**
+最终,数据包到达与目标服务器相同网络上的路由器。这个路由器执行最终的路由决策,并将数据包发送到适当的本地设备(服务器)。
-The process of sending packets across the internet (The Network Layer) is used for essentially all communication over the internet. So it was used for all the steps earlier (like resolving the domain name, the TCP handshake, etc) however there’s only so much that can be explained at once.
+11. **服务器接收**:
+服务器的路由器通过本地网络段将数据包转发到服务器。链路层确保帧正确传输到服务器的网络接口。(它一直在为整个过程中的每台机器→机器通信做这件事。)
-### 6\. Server Response
+13. **服务器处理**:
+服务器接收帧,提取 IP 数据包,并处理封装的 TCP 段以重建原始 HTTP 请求。然后服务器生成 HTTP 响应,过程反转,将响应发送回客户端。
-The server receives the HTTP request and processes it. After processing the request, the server sends an HTTP response back to the client. The response includes:
+⁉️
-- **Protocol** (The HTTP version being used)
-- **Status information** (The HTML Status code like 200, 404, etc)
-- **Response headers** (Like Request Header but Response)
-- **Requested content/Body** (The actual content, such as HTML of the request page or JSON data)
+通过互联网发送数据包的过程(网络层)基本上用于互联网上的所有通信。因此它用于之前的所有步骤(如解析域名、TCP 握手等),但一次只能解释这么多。
-Copy
+### 6. 服务器响应
-```
+服务器接收 HTTP 请求并处理它。处理请求后,服务器向客户端发送 HTTP 响应。响应包括:
+
+* **协议**(使用的 HTTP 版本)
+* **状态信息**(HTML 状态码,如 200、404 等)
+* **响应头**(与请求头类似,但是响应)
+* **请求的内容/正文**(实际内容,如请求页面的 HTML 或 JSON 数据)
+
+```bash
HTTP/1.1 200 OK
Date: Sat, 26 May 2023 10:00:00 GMT
Server: Apache/2.4.41 (Ubuntu)
@@ -236,159 +157,144 @@ Content-Length: 3456