HTTP protocol Basics

Source: Internet
Author: User

Origin

Since the human have the text, used to remember, writing, and even write a love letter, with the text is organized in a linear structure, the text can not be linked to jump. For example, a sister in the love letter when you want to point to a link to the boyfriend's letter said to buy the crazy 6 introduction, which at the time was not done.

So in the 1945 "Atlantic Monthly" by Vannevar Bush issued a new structure of the text: nonlinear structure, the article calls for the thinking of the people and all the knowledge to establish a new relationship. But in the circumstances, Bush's ideas did not become a reality.

Until 1965, American scholar Ted Nelson created the term hypertext, " non-continuous writing, forked, text that allows the reader to make choices, preferably on an interactive screen ," where each text can jump through a link . But specific to how these hypertext display on the interactive screen, how to organize and how to transfer the hypertext, and so on the decision to make it to the future generations, the deep work and name.

In 1989, Tim Berners-lee and his team finally lived up to Nelson's expectations of posterity, invented the original Web server and the Web browser that presented the hypertext, and the markup language HTML used to describe the relationship between the hypertext, Of course there are protocols for transmitting hypertext between the Web server and the browser, which is the Hypertext Transfer Protocol HTTP we are introducing today.

Working mechanism

Let's take a look at the HTTP work steps first:

    1. First the client sends an HTTP request server to establish a TCP connection
    2. After the connection is established, the client begins to send the request
    3. After the server receives the request, it begins to process it accordingly.
    4. The server returns the processed results to the client
    5. The client parses the response content from the browser to generate the page

Here we open a page in chrome and use f12->network->timing to look at each of these steps, as in the following example:

DNS Lookup is used to locate the server address

Initial connection is the 1th step mentioned above: establishing a TCP connection

Request sent is the 2nd step to send

Waitting is waiting for the server to return the 1th byte of time, here is a simple understanding of the server processing time, corresponding to the 3rd step

Content Download receives all response data from the server, corresponding to the 4th step

Above is an approximate flow of HTTP, let's look at the composition of the "Request" and "response" mentioned above

HTTP message composition

The request message and the response message are composed of the starting line , the head and the main body part, in which its implementation and the head is necessary, the main part is optional, is a GET request message with Fiddler grasping, you can observe the composition:

    • Request Line: Provides HTTP method, URL, and HTTP protocol version information, common HTTP method has get, POST
    • Request header: To provide some additional information to the server, commonly used such as client type, cookies, cache control, etc., which will be explained in detail in subsequent articles, please follow our public number
    • Request body: Usually the Post class request will have a body part, such as the form data containing the user registration information. Because the GET request is shown in the example above, there is no request body

Again, we'll look at the response message.

    • Response Line: Includes the requested result status code and the status of summary information, such as 200 for normal return, 404 indicates that the server does not exist the requested resource, 500 for server error
    • Response Headers: Additional information from the server to the client, such as the main content type, cache control, transmission encoding, etc., which we will explain in detail in subsequent articles
    • Response Body: Body content, such as HTML, XML, JSON, pictures, etc.

The above is just a general introduction to the HTTP protocol, but with us as an ideal, have the sentiment of the cock silk test, know that these are still far from enough, in the development, in front of the sister or force lattice not up. But we will have a deeper, more detailed analysis of the follow-up. A minute every day! Please look forward to!

HTTP protocol Basics

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.