Skip to content

HTTP

一句话解释

HTTP (HyperText Transfer Protocol) 是设置的 规则浏览器 and 服务器 use 到请求 and 发送 web resources.

用大白话说

HTTP 是the language of the web。 When you type a URL or click a link, your browser sends an HTTP request to a server. The server processes the request and sends back an HTTP response — usually an HTML page, an image, JSON data, or an error code.

每个HTTP message has a method (what you want to do), a URL (what you want it done to), headers (metadata), and an optional body. The most common methods are GET (fetch a resource), POST (submit data), PUT (replace a resource), and DELETE (remove a resource).

HTTPS is the secure version of HTTP — the same protocol but encrypted with TLS. Every response carries a status code: 200 means success, 404 means not found, 500 means server error. Understanding these codes helps you debug web applications.

示例

http
GET /users/42 HTTP/1.1
Host: api.example.com
Accept: application/json

---

HTTP/1.1 200 OK
Content-Type: application/json

{ "id": 42, "name": "Ada" }

GET 请求 for /用户/42 and 服务器's 200 OK 响应使用 JSON 请求体.

工作原理

  1. The browser sends an HTTP request with a method (GET/POST/...), URL, and headers.
  2. The server processes the request and finds the requested resource.
  3. The server returns an HTTP response with a status code, headers, and body.
  4. The browser renders the response (HTML) or hands it to JavaScript (JSON).

相关术语

相关资源

相关课程

  • HTTP

    学习 HTTP 方法, 请求头, and 状态 codes

相关练习

相关工具

  • JWT Decoder

    Inspect JWT 令牌 used in HTTP 认证请求头

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表