A personal understanding of the complete process of an HTTP request

Source: Internet
Author: User

As the time of contact web development grows, oneself also has own opinion to the HTTP request, but all is oneself understanding, not necessarily very correct, in this record, convenient later after further study, used to compare and present understanding difference.

As we all know, in the server needs to define the URL and the View function mapping relationship, what is the mapping relationship?

Assuming that the URL is now defined and the view function is mapped, now I enter url=http://127.0.0.1/index/in the browser, and the browser sends a request to the server--->> the server receives the request---->> The parse request header-----> Discovery Request URL is the index/---->> Query url-View function mapping table, if a URL is found, Calls the corresponding view function (here Views.index) to process the request and returns the processed results back to the browser, or 404 if no corresponding URL is found, indicating that no corresponding resource was found.

This process is like, you are now a customer (browser), you know that a store (view function) has the goods you need (the requested resources), then when you know the store address (URL), you will go past the store (initiate the request), tell the store what you want, then the store to find the goods (processing requests), Then sell it to you (in response to the request). However, the store feels that the goods sold are too simple, in addition to the original daily necessities (get), but now also added jewelry (post), electronic devices (put) and other products (HTTP other request methods, such as delete, etc.). At this time you go to the store to buy goods (Request to view function), to tell the store, I want to buy xxx daily necessities (request in the head is GET request way), this time store in charge of daily necessities will find you xxx daily necessities, and sold to you. Then after a period of time, and want to go to the same shop to buy things, or according to the original address (URL) to the store (view function), this time found that the store actually moved away, when the address and store mapping relationship disappeared, there is no store processing you want to buy goods request, this time is equivalent to 404 status Code, If the store has a new address at the door, then you can go to the new address to find the shop, which is equivalent to the 302 status code.

A personal understanding of the complete process of an HTTP request

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.