"Frequently asked" HTTP 1.1 differs from HTTP 1.0

Source: Internet
Author: User
Tags rfc

Comparison of HTTP 1.1 and HTTP 1.0

http://blog.csdn.net/weizhaozhe/article/details/3958945

A Web site may receive millions of user requests a day, in order to improve the efficiency of the system, HTTP 1.0 requires the browser and the server to maintain only a brief connection, every time the browser needs to establish a TCP connection with the server, the server completes the request processing immediately disconnect the TCP connection, The server does not track each customer nor does it record past requests. However, this also creates some performance flaws, for example, a Web page file that contains many images does not contain real image data content, but merely indicates the URL of the image, and when the Web browser accesses the Web page file, the browser first makes a request for the page file. When the browser resolves the HTML content in the document of the Web page returned by the server, and the image label is found, the browser sends a request to the server to download the image data again according to the URL address specified by the SRC attribute in the label. As shown in Figure 3.3.

Figure 3.3

Obviously, the entire process of accessing a Web page file that contains many images includes multiple requests and responses, each requiring a separate connection, each connecting only one document and image, and the last and next request completely detached. Even though the image files are small, each connection between the client and the server is a relatively time-consuming process and can severely affect the performance of the client and server. This can happen when a Web page file contains applet,javascript files, CSS files, and so on.

To overcome this flaw in HTTP 1.0, HTTP 1.1 supports persistent connections, where multiple HTTP requests and responses can be delivered on a single TCP connection, reducing the consumption and latency of establishing and closing connections. Multiple requests and responses to a Web page file that contains many images can be transmitted in a single connection, but requests and replies to each individual Web page file still need to use their own connections. HTTP 1.1 also allows the client to issue 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 differentiate between the response content of each request. This also significantly reduces the time required for the entire download process. The process of exchanging information between a client and a server based on the HTTP 1.1 protocol, as shown in Figure 3.4.

Figure 3.4

As you can see, HTTP 1.1 overcomes the performance problems of HTTP 1.0, based on the advantages of HTTP 1.0. Furthermore, HTTP 1.1 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, the Web browser cannot use host header names to explicitly indicate which Web site to access on the server, so that you cannot use the 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, Web browsers can use host header names to explicitly indicate which Web site to access on the server, which enables you to create multiple virtual Web sites on a single Web server using a different hostname on the same IP address and port number. The continuous connection of HTTP 1.1 also requires the addition of a new request header to help implement, for example, when the connection request header has a value of keep-alive, the client notifies the server to remain connected after returning the result of this request, and the connection request header value 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 identity authentication, state management, and cache caching.

In-depth experience of the inside of Java Web Development-core Basics

HTTP protocol old Standard is http/1.0, the current most common standard is http/1.1. http/1.1 is upgraded on http/1.0 basis, adding some functionality to fully compatible http/1.0. http/1.0 does not support file breakpoint continuation, the current Web server most of the use of http/1.1.
Range:bytes is http/1.1 new, http/1.0 every time the file is routed from the beginning of the file, that is, 0 bytes at the beginning. RANGE:BYTES=XXXX indicates that the server is required to start transmitting from the file XXXX byte, which is what we call a continuation of the breakpoint at ordinary times.

English version of the original
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 disadvantages of the current HTTP protocol, the World Wide Web Consortium began to study the next generation HTTP protocol? Ttp-ng. It is divided into three levels: application layer, message layer, transport layer. Applications on the existing 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 does not see, has seen to tell me:

Attached: HTTP 1.1 status Code and what it means
Status Code state information meaning
The initial request of Continue has been accepted and the customer should continue to send the remainder of the request. (HTTP 1.1 new)
The switching protocols server converts requests to a different protocol (HTTP 1.1 new)
All OK, the answer document for Get and post requests follows.
The 201 Created Server has created the document, and the location header gives its URL.
The accepted has accepted the request, but the processing has not yet 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 is being used (HTTP 1.1 new).
204 No Content does not have a new document, the browser should continue to display the original document. This status code is useful if the user periodically refreshes the page and the servlet can determine that the user's document is new enough.
205 The Reset content does not have new content, but the browser should reset what it displays. Used to force the browser to clear form input (HTTP 1.1 new).
206 Partial Content Customer sent a GET request with a range header, and the server completed it (HTTP 1.1 new).
Multiple choices customer-requested documents can be found in multiple locations that are already listed in the returned document. If the server wants to make a preference, it should be indicated in the location answer header.
Moved permanently customer requested document elsewhere, the new URL is given in the location header, and the browser should automatically access the new URL.
The 302 Found is similar to 301, but the new URL should be treated as a temporary alternative, not permanent. Note that the corresponding state information in the HTTP1.0 is "moved temporatily".
When this 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 replaced with 301. For example, if the browser incorrectly requests Http://host/~user (a 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. Please see 307.

303 The other is similar to 301/302, except that if the original request was post,location the redirected target document specified by the header should be fetched through get (HTTP 1.1 new).
The 304 not Modified client has buffered documents and makes a conditional request (typically providing a if-modified-since header that indicates that the customer only wants to update the document for a specified date). The server tells the customer that the previously buffered document can continue to be used.
305 Use proxy Client-requested documentation should be extracted via the proxy server indicated by the location header (HTTP 1.1 new).
307 Temporary Redirect and 302 (Found) are the same. Many browsers incorrectly respond to 302 responses for redirection, even if the original request is post, even if it is actually only redirected when the POST request is answered at 303. For this reason, HTTP 1.1 has been added 307 to further clear the locale code: when a 303 reply occurs, the browser can follow the redirected get and post requests, and if 307 answers, the browser can only follow the redirection of the got request. (HTTP 1.1 new)
Bad request syntax error occurred.
401 Unauthorized customer is trying to access a password-protected page without authorization. A www-authenticate header is included in the answer, the browser displays the user name/password dialog Accordingly, and then makes the 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 a permission setting on a file or directory on the server.
404 Not Found Cannot find a resource at the specified location. This is also a common answer.
The 405 method does not allowed request methods (GET, POST, head, DELETE, put, Trace, and so on) 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).
The 407 proxy authentication Required is similar to 401, which means that the customer must first be authorized by the proxy server. (HTTP 1.1 new)
408 Request Timeout The customer has not made any requests for the duration of the server license. Customers can repeat the same request at a later time. (HTTP 1.1 new)
409 Conflict are usually associated with put requests. The request cannot succeed because the request and the current state of the resource are conflicting. (HTTP 1.1 new)
410 Gone The requested document is no longer available and the server does not know which address should be redirected to. It differs from 404 in that the return of 407 indicates that the document left the specified location permanently, while 404 indicates that the document is not available because of an unknown reason. (HTTP 1.1 new)
411 Length Required The server cannot process the request unless the customer sends a content-length header. (HTTP 1.1 new)
Some prerequisites specified in the 412 precondition Failed 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 considers itself able to process the request later, it should provide a Retry-after header (HTTP 1.1 new).
414 Request Uri Too long URI (HTTP 1.1 new).
The 416 requested range not satisfiable server does not meet the range header specified by the customer in the request. (HTTP 1.1 new)
Internal server Error Servers encountered unexpected circumstances, unable to complete the customer's request.
The 501 not implemented server does not support the functionality required to implement the request. For example, the customer issued a put request that the server does not support.
502 Bad Gateway server, as a gateway or proxy, accesses the next server in order to complete the request, but the server returns an illegal reply.
503 Service unavailable Server failed to answer due to maintenance or overload. For example, a servlet might return 503 if the database connection pool is full. The server can provide a retry-after header when it returns 503.
The 504 Gateway Timeout is used by a server acting as a proxy or gateway, indicating that an answer cannot be received from a remote server 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/

Implementation of 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 multithreaded programming technology, at the same time start multiple threads, according to the number of threads, the calculation of file segmentation location, to send several different download breakpoints to the server, while accepting data and write files, you can achieve multithreading download.

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.