HTTP: Hypertext Transfer Protocol | MDN
HTTP is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more.
概览
收录于
2026年3月18日
学科与领域
coding · apis-integration
年级范围
九年级(高一)–十二年级(高四)
页面类型
Article
简介
Overview of the Hypertext Transfer Protocol (HTTP)
- Core Definition: HTTP is an application-layer protocol designed for transmitting hypermedia documents (like HTML) between web browsers and servers.
- Communication Model: It follows a classical client-server model where a client initiates a request and waits for a server response.
- Stateless Nature: HTTP is inherently stateless; however, state can be introduced via cookies (using
Set-CookieandCookieheaders). - Extensibility: The protocol is highly extensible, supporting various methods, headers, and extensions developed since its inception in the early 1990s.
- Key Concepts:
- URIs: Uniform Resource Identifiers are used to locate resources.
- Messages: Requests and responses follow a defined structure.
- MIME Types: Used to identify and transmit different content formats.
- Caching: Mechanisms to improve performance and resource efficiency.
- Authentication: Methods to verify client identity.
- Security: Includes features like CORS (Cross-Origin Resource Sharing), CSP (Content Security Policy), and CORP (Cross-Origin Resource Policy).
- Protocol Evolution: The protocol has evolved through several versions: HTTP/0.9, HTTP/1.0, HTTP/1.1, HTTP/2, and HTTP/3.
- Advanced Features:
- Conditional Requests: Used for caching and resuming downloads.
- Range Requests: Allows fetching specific parts of a resource.
- Content Negotiation: Enables clients to request specific formats, languages, or encodings.
- Connection Management: Supports persistent connections and protocol upgrades (e.g., to WebSockets).
- Reference Documentation: HTTP includes standardized status codes (grouped into five classes), request methods (e.g., GET, POST), and extensive header metadata.
- Debugging Tools: Recommended tools include Firefox Developer Tools, HTTP Observatory, RedBot, nghttp2, and
curl.
用户评价
暂无已发布的评价,欢迎率先分享您的使用体验。