Technology Sharing

Differences between HTTP1.0 and HTTP1.1

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Persistent Connections

HTTP/1.1Persistent connections are supported by default, allowing multiple HTTP requests and responses to be sent over a single TCP connection, reducing the overhead of establishing and closing connections.

andHTTP/1.0The default is a short connection. Each request requires a TCP connection to be established.Connection: keep-aliveheader to achieve persistent connections.Connection: keep-aliveThe role of is to tell the server and the client that the TCP connection between them should be kept active so that it can be reused, rather than being closed immediately after sending a response. This feature was introduced in HTTP/1.0 and became the default behavior in HTTP/1.1.

Pipelining

HTTP/1.1Supports pipelining (not enabled by default), allowing the client to send multiple requests before the response to the first request arrives, which can reduce waiting time and improve efficiency.

HTTP/1.0 does not support pipelining.

Cache Control

HTTP1.0Main UseIf-Modified-Since/ExpiresAs a standard for cache judgment

HTTP1.1More cache control strategies are introduced, such asEtag / If-None-MatchAnd more optional cache headers to control the caching strategy.

Error handling:

HTTP/1.1Added some new HTTP status codes, such as100 Continue, used to enhance error handling and intermediate responses of requests.

After receiving a 100 Continue response, the client should continue to send the request body.Expect: 100-continueIf the server decides not to continue processing the request (for example, if the request header information indicates that the request cannot be accepted), the server SHOULD return an error status code (such as 400 Bad Request) instead of 100 Continue.

Hosthead:

HTTP/1.1introducedHostHeader, allowing the client to specify the host name of the request, which makes it possible to host multiple domain names on the same server. Each domain name can be mapped to a different resource or service on the server. HTTP/1.0 does not have this header field.

Bandwidth Optimization:

HTTP1.0There are some bandwidth waste phenomena in the process, for example, the client only needs a part of an object, but the server sends the whole object and does not support the breakpoint resume function.HTTP1.1Then the request header is introducedrangeHeader field, which allows only a certain part of the resource to be requested, that is, the return code is206(Partial Content)