The content of this article is about understanding HTTP, HTTPS, SPDY, and HTTP2 at one time. It has certain reference value and should be used if necessary. Friends can refer to it, I hope it will be helpful to you.
As a veteran of Internet communication protocols, the HTTP protocol has gone through three version changes today. The latest version is HTTP2.0, which I believe everyone is familiar with. . Today I will give you a good introduction to the past and present of HTTP.
HTTP/0.9
The earliest version of HTTP was born in 1991. This earliest version is extremely simple compared to now, with no HTTP header, no status code, and even version There was no number, and later its version number was set to 0.9 to distinguish it from other versions of HTTP. HTTP/0.9 only supports one method - Get, and the request has only one line.
GET /hello.html
The response is also very simple, only containing the html document itself.
<HTML> Hello world </HTML>
When the TCP connection is established, the server returns a string in HTML format to the client. After sending, close the TCP connection. Since there are no status codes and error codes, if an error occurs during server processing, only a special HTML file containing problem description information will be returned. This is the earliest version of HTTP/0.9.
HTTP/1.0
In 1996, the HTTP/1.0 version was released, which greatly enriched the transmission content of HTTP. In addition to text, you can also send pictures, videos, etc. This It laid the foundation for the development of the Internet. Compared with HTTP/0.9, HTTP/1.0 mainly has the following features:
Requests and responses support HTTP headers, status codes are added, and the beginning of the response object is a response status line
Protocol version Information needs to be sent along with the request, supporting HEAD and POST methods
Supports transmitting other types of content besides HTML files
A typical HTTP/1.0 request looks like this:
GET /hello.html HTTP/1.0 User-Agent:NCSA_Mosaic/2.0(Windows3.1) 200 OK Date: Tue, 15 Nov 1996 08:12:31 GMT Server: CERN/3.0 libwww/2.17 Content-Type: text/html <HTML> 一个包含图片的页面 <img src="/static/imghwm/default1.png" data-src="/smile.gif" class="lazy" alt="Understand HTTP, HTTPS, SPDY, HTTP2 at once" > </HTML>
HTTP/1.1
HTTP/1.1 was released a few months after HTTP/1.0. HTTP/1.1 is more of an improvement on HTTP/1.0. In HTTP1.1, it mainly has the following improvements:
Can reuse connections
Add pipeline: HTTP pipeline is to A technology that submits multiple HTTP requests in batches without waiting for a response from the server during transmission. The pipeline mechanism must be completed through a persistent connection. The browser's batch submission of HTTP requests can greatly shorten the page loading time, especially when the transmission delay (lag/latency) is high. One thing to note is that only idempotent requests can use the pipeline, such as GET and HEAD methods.
Chunked encoding transmission: This encoding transmits the entity in chunks and indicates the length block by block until the length is 0 blocks indicating the end of the transmission. This is particularly useful when the length of the entity is unknown (such as data dynamically generated by the database)
Introduce more cache control mechanisms: such as etag, cache-control
Introduce content negotiation mechanisms, including language, encoding, type, etc., and allow the client and server to agree on the most appropriate Content exchange
Both request messages and response messages support the Host header field: In HTTP1.0, each server is considered to be bound to a unique IP address. Therefore, the URL in the request message does not pass the host name. (hostname). However, with the development of virtual host technology, multiple virtual hosts (Multi-homed Web Servers) can exist on a physical server, and they share an IP address. Therefore, the introduction of the Host header is necessary.
Added OPTIONS, PUT, DELETE, TRACE, CONNECT methods
Although HTTP/1.1 has been optimized in many points, as the most widely used protocol version, it can already satisfy many networks However, as web pages become more and more complex and even evolve into independent applications, HTTP/1.1 gradually exposes some problems:
When transmitting data, the connection must be re-established every time, which is The mobile terminal is particularly unfriendly
The transmission content is plain text, which is not secure enough
The header content is too large, and the header does not change much every time the request is made, causing waste
keep-alive to the service The end brings performance pressure
In order to solve these problems, HTTPS and SPDY came into being.
SPDY
In fact, SPDY is not a new protocol, but a session layer before HTTP.
Between 2010 and 2015, Google demonstrated an alternative way of exchanging data between the client and server by implementing an experimental SPDY protocol. It captures the focus of browser and server-side developers, clarifies the increase in response volume and solves the complexity of data transfer. The default goal when starting the SPDY project is:
Reduce page load time (PLT) by 50%.
No need for the website author to modify any content.
Minimize deployment complexity without changing network infrastructure.
Working with the open source community to develop this new protocol.
Collect real performance data to verify whether this experimental protocol is effective.
In order to achieve the goal of reducing page load times, SPDY introduces a new binary framing data layer to enable multi-directional requests and responses, prioritize, minimize and eliminate unnecessary network delays, with the goal of Make more efficient use of underlying TCP connections.
HTTP/2.0
In 2015, HTTP/2.0 came out. Let’s first introduce the characteristics of HTTP/2.0:
Use binary framing layer: Add a binary framing layer between the application layer and the transport layer to achieve the HTTP method without changing the semantics of HTTP. , status code, URI and header fields, break through the performance limitations of HTTP1.1, improve transmission performance, and achieve low latency and high throughput. At the binary framing layer, HTTP2.0 will divide all transmitted information into smaller messages and frames, and encode them in binary format. The header information of HTTP1.x will be encapsulated into the Headers frame, and we The request body is encapsulated into the Data frame.
Binary Framing
Multiplexing: For HTTP/1.x, even if a long connection is enabled, the request is sent serially. When the bandwidth is sufficient, The utilization rate of bandwidth is not enough. HTTP/2.0 adopts multiplexing method, which can send multiple requests in parallel to improve the utilization rate of bandwidth.
Multiplexing
Data flow priority: Since requests can be sent concurrently, if the browser is waiting for key CSS or JS files to complete rendering of the page, the server What should I do if I am focusing on sending picture resources? HTTP/2.0 can set a priority value for data flows. This priority value determines the different priority strategies used by the client and server to process different flows.
Server-side push: In HTTP/2.0, the server can send content other than the request to the client. For example, when a page is being requested, the server will push the page-related logo, CSS and other files directly to the client. , instead of waiting until the request comes before sending it, because the server thinks that the client will use these things. This is equivalent to gathering all resources in one HTML document.
Header compression: Use the header table to track and store previously sent key-value pairs. The same content will not be sent in each request and response.
The above is a complete introduction to understanding HTTP, HTTPS, SPDY, and HTTP2 at one time. If you want to know more about Html5 tutorial, please pay attention to the PHP Chinese website.
The above is the detailed content of Understand HTTP, HTTPS, SPDY, HTTP2 at once. For more information, please follow other related articles on the PHP Chinese website!

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool