Initial knowledge of HTTP 1.1 vs. HTTP 1.0

Source: Internet
Author: User
Tags rfc

HTTP 1.1 comparison with HTTP 1.0

A Web site may be receiving millions of user requests per day, in order to improve the efficiency of the system, HTTP 1.0 specifies that the browser and the server only a short connection, each request of the browser needs to establish a TCP connection with the server, the server completes the request processing and immediately disconnects the TCP connection. The server does not track each customer and does not log past requests. However, this also creates some performance flaws, for example, a Web file containing many images does not contain the actual image data content, but only indicates the URL address of these images, when the Web browser accesses the Web file, the browser first to issue a request for the Web page file, When the browser resolves the HTML content in the webpage document returned by the Web server and discovers the image tag in it, the browser will again issue a request to the server to download the image data according to the URL address specified in the SRC attribute in the tag, as shown in 3.3.

Figure 3.3

Obviously, the entire process of accessing a Web page file containing many images consists of multiple requests and responses, each of which requires a separate connection, each of which transmits only one document and image, and the last and the next request are completely detached. Even though the image files are small, it is a relatively time-consuming process to establish and close each connection between the client and server, and it can severely affect the performance of the client and server. When a Web page file contains applet,javascript files, CSS files and other content, it will also appear similar to the above situation.

To overcome this flaw in HTTP 1.0, HTTP 1.1 supports persistent connections, which can transmit multiple HTTP requests and responses on a single TCP connection, reducing the consumption and latency of establishing and shutting down connections. Multiple requests and responses for a Web page file that contains many images can be transferred in one connection, but requests and responses for each individual Web file still need to use their own connection. HTTP 1.1 also allows the client to make the next request without waiting for the last request result to be returned, but the server side must echo the response in the order in which the client requests are received, to ensure that the client can distinguish the response from each request. This also significantly reduces the time required for the entire download process. The information exchange process between client and server based on the HTTP 1.1 protocol, as shown in 3.4.

Figure 3.4

As you can see, HTTP 1.1 overcomes the performance issues of HTTP 1.0, based on the advantages of HTTP 1.0. Not only that, HTTP 1.1 also improves and expands the functionality of HTTP 1.0 by adding more request headers and response headers. For example, because HTTP 1.0 does not support host Request header fields, Web browsers cannot use host header names to explicitly indicate which Web site to access on the server, so you cannot use a Web server to configure multiple virtual Web sites on the same IP address and port number. After adding the host Request Header field in HTTP 1.1, the Web browser can use the host header name to explicitly indicate which Web site to access on the server, which enables multiple virtual Web sites to be created on a single Web server with a different hostname on the same IP address and port number. HTTP 1.1 Persistent connection, also need to add new request header to help implement, for example, when the value of the connection request header is keep-alive, the client notifies the server to keep the connection after returning the result of the request, and when the value of the connection request header is close, The client notifies the server to close the connection after returning the result of this request. HTTP 1.1 also provides request headers and response headers related to mechanisms such as authentication, state management, and cache caching.

In-depth experience of Java Web Development Insider-The core Foundation

The old standard of the HTTP protocol is http/1.0, the most common standard currently is http/1.1. http/1.1 is an upgrade on the basis of http/1.0, adding some features, fully compatible with http/1.0. http/1.0 does not support file breakpoint continuation, the majority of the current Web server has adopted the http/1.1.
Range:bytes is a new addition to http/1.1, http/1.0 each transfer file starts at the beginning of the file header, which is 0 bytes. RANGE:BYTES=XXXX indicates that the server is required to start the transmission from the file XXXX byte, which is what we call a continuation of the breakpoint!

Original English version
RFC 1945-hypertext Transfer Protocol--http/1.0
http://www.w3.org/Protocols/rfc1945/rfc1945
Http://www.faqs.org/rfcs/rfc1945.html

RFC 2616-hypertext Transfer Protocol--http/1.1
http://www.w3.org/Protocols/rfc2616/rfc2616
Http://www.w3.org/Protocols/rfc2616/rfc2616.html
Http://www.faqs.org/rfcs/rfc2616.html

(proposed) Http-ng Working Group
http://www.w3.org/Protocols/HTTP-NG/
Next Generation Hypertext Transfer Protocol (HTTP-NG), in order to overcome the shortcomings of the current HTTP protocol, the World Wide Web Consortium began to study the development of next-generation HTTP protocol? Ttp-ng. It is divided into three levels: the application layer, the message layer, the transport layer. Existing applications on the Web will be converted to the Http-ng platform, and the entire platform will be updated to Http-ng.

RFC 1945-hypertext Transfer Protocol--http/1.0 Chinese version
Http://man.chinaunix.net/develop/rfc/RFC1945.txt
Http://www.cnpaf.net/rfc/rfc1945.txt

RFC 2616-hypertext Transfer Protocol--http/1.1 Chinese version

The difference between 1.0 and 1.1, English version
Key Differences between http/1.0 and http/1.1
Http://www.research.att.com/%7Ebala/papers/h0vh1.html

The Chinese translation version did not see, have seen to tell me:)

Attached: HTTP 1.1 status code and its meaning
Status Code status information meaning
Continue the initial request has been accepted and the customer should continue to send the remainder of the request. (HTTP 1.1 new)
101 Switching Protocols Server translates the client's request to another protocol (HTTP 1.1 new)
All OK, the answer document for Get and post requests is followed.
The 201 Created Server has created the document, and the location header gives its URL.
202 Accepted has accepted the request, but the processing has not been completed.
203 Non-authoritative Information The document has returned normally, but some of the answer headers may be incorrect because a copy of the document (HTTP 1.1 new) is being used.
204 No Content There is no new document, the browser should continue to display the original document. This status code is useful if the user refreshes the page on a regular basis and the servlet can determine that the user's document is new enough.
205 Reset content is not new, but the browser should reset what it displays. Used to force the browser to clear the form input (HTTP 1.1 new).
The 206 Partial Content client sends a GET request with a range header that the server has completed (HTTP 1.1 new).
Multiple Choices customer requested documents can be found in multiple locations that have been listed in the returned document. If the server wants to make a preference, it should be indicated in the location answer header.
301 Moved Permanently The document requested by the customer elsewhere, the new URL is given in the location header, and the browser should automatically access the new URL.
302 Found is similar to 301, but the new URL should be treated as a temporary replacement, not a permanent. Note that the corresponding status information in HTTP1.0 is "Moved temporatily".
When the status code appears, the browser can automatically access the new URL, so it is a useful status code.

Note that this status code can sometimes be used with 301 substitutions. For example, if the browser mistakenly requests Http://host/~user (the trailing slash is missing), some servers return 301, and some return 302.

Strictly speaking, we can only assume that the browser will automatically redirect only if the original request is get. See 307.

303 See other is similar to 301/302, except that if the original request is the Post,location header the specified redirect target document should be fetched via get (HTTP 1.1 new).
304 Not Modified client has buffered documents and issued a conditional request (typically providing a if-modified-since header indicating that the customer only wants to update the document than the specified date). The server tells the customer that the original buffered document can continue to be used.
305 Use proxy The document requested by the client should be extracted from the agent server indicated by the location header (HTTP 1.1 is new).
307 Temporary Redirect and 302 (Found) are the same. Many browsers incorrectly respond to a 302 response for redirection, even if the original request is post, even though it can actually be redirected only if the answer to the POST request is 303. For this reason, HTTP 1.1 has been added in 307 to allow for more cleanup of the region in several status codes: When a 303 response occurs, the browser can follow the redirected get and post requests, and if the 307 answer, the browser can only follow the redirect to the GET request. (HTTP 1.1 new)
A syntax error has occurred in the request requests.
401 Unauthorized customer attempts to access password-protected pages without authorization. A www-authenticate header is included in the answer, and the browser displays the user name/Password dialog box, and then makes a request again after filling in the appropriate authorization header.
403 Forbidden resource is not available. The server understands the customer's request, but refuses to process it. This is usually caused by the permissions set on the file or directory on the server.
404 Not Found Could not find the resource at the specified location. This is also a common answer.
The 405 method not allowed request methods (GET, POST, HEAD, DELETE, PUT, trace, etc.) do not apply to the specified resource. (HTTP 1.1 new)
406 not acceptable the specified resource has been found, but its MIME type is incompatible with the client specified in the Accpet header (HTTP 1.1 new).
407 Proxy authentication Required is similar to 401, which means that the client must be authorized by the proxy server first. (HTTP 1.1 new)
408 Request Timeout The customer has not made any requests during the waiting time of the server license. Customers can repeat the same request at a later time. (HTTP 1.1 new)
409 Conflict is usually associated with a put request. The request cannot succeed because the request conflicts with the current state of the resource. (HTTP 1.1 new)
410 Gone The requested document is no longer available, and the server does not know which address to redirect to. It differs from 404 in that returning 407 means that the document has permanently left the specified location, and 404 indicates that the document is unavailable for unknown reasons. (HTTP 1.1 new)
411 Length Required The server cannot process the request unless the client sends a content-length header. (HTTP 1.1 new)
412 Precondition Failed Some of the prerequisites specified in the request header failed (HTTP 1.1 new).
413 Request Entity Too Large the size of the target document exceeds the size that the server is currently willing to handle. If the server thinks it can process the request later, it should provide a Retry-after header (HTTP 1.1 new).
414 Request Uri Too Long URI is too lengthy (HTTP 1.1 new).
416 requested range not satisfiable server does not meet the Range header specified by the customer in the request. (HTTP 1.1 new)
The Internal server Error server encountered unexpected conditions and was unable to complete the customer's request.
The 501 not implemented server does not support the functionality required to implement the request. For example, a customer sends a put request that is not supported by the server.
502 Bad Gateway server as a gateway or proxy, the server returned an illegal reply in order to complete the request to access the next server.
503 Service Unavailable Server failed to answer due to maintenance or heavy load. For example, a servlet might return 503 if the database connection pool is full. A retry-after header can be supplied when the server returns 503.
504 Gateway Timeout is used by a server acting as a proxy or gateway, indicating that it is not able to get answers from remote servers in a timely manner. (HTTP 1.1 new)
505 HTTP version not supported server does not support HTTP versions as specified in the request. (HTTP 1.1 new)

===================================================================================
More Resources ...
http://www.w3.org/
China Protocol Analysis Network http://www.cnpaf.net/

Implementing HTTP protocol client application with socket class
Http://developer.51cto.com/art/200510/6751.htm

Download software with Java design
Http://www.yesky.com/239/1739739.shtml
Using multi-threaded programming technology, start multiple threads at the same time, according to the number of threads, calculate the location of the file split, send several different download breakpoints to the server, while accepting data and writing to the file, you can achieve multi-threaded download.

Reference: http://blog.csdn.net/elifefly/article/details/3964766

Initial knowledge of HTTP 1.1 vs. HTTP 1.0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.