Home Web Front-end HTML Tutorial Understand HTTP, HTTPS, SPDY, HTTP2 at once

Understand HTTP, HTTPS, SPDY, HTTP2 at once

Nov 13, 2018 pm 04:20 PM
http https


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.

Understand HTTP, HTTPS, SPDY, HTTP2 at once

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>
Copy after login

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/imghw/default1.png"  data-src="/smile.gif"  class="lazy" alt="Understand HTTP, HTTPS, SPDY, HTTP2 at once" >
</HTML>
Copy after login

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

What is http status code 403? What is http status code 403? Oct 07, 2023 pm 02:04 PM

HTTP status code 403 means that the server rejected the client's request. The solution to http status code 403 is: 1. Check the authentication credentials. If the server requires authentication, ensure that the correct credentials are provided; 2. Check the IP address restrictions. If the server has restricted the IP address, ensure that the client's IP address is restricted. Whitelisted or not blacklisted; 3. Check the file permission settings. If the 403 status code is related to the permission settings of the file or directory, ensure that the client has sufficient permissions to access these files or directories, etc.

How to use Nginx Proxy Manager to implement reverse proxy under HTTPS protocol How to use Nginx Proxy Manager to implement reverse proxy under HTTPS protocol Sep 26, 2023 am 08:40 AM

How to use NginxProxyManager to implement reverse proxy under HTTPS protocol. In recent years, with the popularity of the Internet and the diversification of application scenarios, the access methods of websites and applications have become more and more complex. In order to improve website access efficiency and security, many websites have begun to use reverse proxies to handle user requests. The reverse proxy for the HTTPS protocol plays an important role in protecting user privacy and ensuring communication security. This article will introduce how to use NginxProxy

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS Sep 26, 2023 am 11:19 AM

How to use NginxProxyManager to implement automatic jump from HTTP to HTTPS. With the development of the Internet, more and more websites are beginning to use the HTTPS protocol to encrypt data transmission to improve data security and user privacy protection. Since the HTTPS protocol requires the support of an SSL certificate, certain technical support is required when deploying the HTTPS protocol. Nginx is a powerful and commonly used HTTP server and reverse proxy server, and NginxProxy

HTTP 200 OK: Understand the meaning and purpose of a successful response HTTP 200 OK: Understand the meaning and purpose of a successful response Dec 26, 2023 am 10:25 AM

HTTP Status Code 200: Explore the Meaning and Purpose of Successful Responses HTTP status codes are numeric codes used to indicate the status of a server's response. Among them, status code 200 indicates that the request has been successfully processed by the server. This article will explore the specific meaning and use of HTTP status code 200. First, let us understand the classification of HTTP status codes. Status codes are divided into five categories, namely 1xx, 2xx, 3xx, 4xx and 5xx. Among them, 2xx indicates a successful response. And 200 is the most common status code in 2xx

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Sep 12, 2023 pm 01:15 PM

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files With the development of the Internet, the file download function has become one of the basic needs of many websites and applications. For scenarios where multiple files need to be downloaded at the same time, the traditional synchronous download method is often inefficient and time-consuming. For this reason, using PHP to download multiple files asynchronously over HTTP has become an increasingly common solution. This article will analyze in detail how to use PHP asynchronous HTTP through an actual development case.

Common network communication and security problems and solutions in C# Common network communication and security problems and solutions in C# Oct 09, 2023 pm 09:21 PM

Common network communication and security problems and solutions in C# In today's Internet era, network communication has become an indispensable part of software development. In C#, we usually encounter some network communication problems, such as data transmission security, network connection stability, etc. This article will discuss in detail common network communication and security issues in C# and provide corresponding solutions and code examples. 1. Network communication problems Network connection interruption: During the network communication process, the network connection may be interrupted, which may cause

See all articles