Classic analysis from instances-HTTP protocol (1)

Source: Internet
Author: User

Classic analysis from instances-HTTP protocol (1)

The development technology of today's web programs is truly a battle, ASP. NET, PHP, JSP, Perl, AJAX, and so on. Regardless of the future development of Web technology, it is important to understand the basic protocols for communication between Web applications because they allow us to understand the internal work of Web applications. This article will explain the HTTP protocol in detail, with a lot of content, and hope it will be helpful for your development or testing work.

What is HTTP?

Protocol refers to the regulations or rules that must be followed by two computers in a computer communication network. Hypertext Transfer Protocol (HTTP) is a communication protocol, it allows the transfer of Hypertext Markup Language (HTML) documents from the Web server to the client's browser.

Web server, browser, Proxy Server

When we open the browser, enter the URL in the address bar, and then we can see the webpage. What is the principle?

In fact, after we enter the URL, our browser sends a Request to the Web server. After receiving the Request, the Web server processes the Request, generates the corresponding Response, and then sends it to the browser, the browser parses the HTML in Response, so that we can see the webpage, as shown in the process.

Our Request may be sent to the Web server only after it passes through the proxy server.

Shows the process.

The proxy server is the transfer station of network information. What functions does it provide?

1. Improve access speed. Most proxy servers have the cache function.

2. Break through the limitations, that is, FQ.

3. Hide the identity.

URL details

The URL (Uniform Resource Locator) address is used to describe resources on a network. The basic format is as follows:

schema://host[:port#]/path/.../[?query-string][#anchor]

Scheme specifies the protocol used at the lower layer (for example, http, https, and ftp)

IP address or domain name of the host HTTP Server

Port # The default port number of the HTTP server is 80. In this case, the port number can be omitted. If another port is used, you must specify, for example, http://www.cnblogs.com: 8080/

Path

Data sent from query-string to the http server

Anchor-anchor

An example of URL:

http://www.mywebsite.com/sj/test/test.aspx?name=sviergn&x=true#stuff

Schema: http
host: www.mywebsite.com
path: /sj/test/test.aspx
Query String: name=sviergn&x=true
Anchor: stuff

The HTTP protocol is stateless.

The http protocol is stateless. The request of the same client does not correspond to the previous request. For the http server, it does not know that the two requests come from the same client. To solve this problem, the Web Program introduces the Cookie mechanism to maintain the status.

The browser needs to send many requests to open a webpage.

1. When you enter the URL http://www.cnblogs.com in the browser, the browser sends a Request to get the html of the http://www.cnblogs.com. The server sends the Response back to the browser.

2. the browser analyzes the HTML in Response and finds that many other files, such as slice, CSS file, and JS file are referenced.

3. the browser will automatically send a Request to retrieve images, CSS files, or JS files.

4. After all files are downloaded successfully. The web page is displayed.


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.