HTTP protocol Communication Process

Source: Internet
Author: User

HTTP is a one-time data object that sends a request and then returns a response to form a complete interface. In fact, a complete HTTP request has multiple steps, but it is encapsulated.

It is necessary to understand the HTTP communication process, especially with regard to performance testing and security testing of some interfaces. It also helps to learn more complex protocols at the bottom.

1. DNS Lookup

DNS lookup is a domain name resolution process that translates a domain name into an IP that is dependent on IP for access in the Internet, and that the domain name is just a title that is created for easy memory. If the direct IP access, then there is no DNS loopup this step. In another case, a domain name that has been resolved in the short term will also be read directly from the previously parsed cache, skipping the DNS lookup process.

2. TCP Connect

That is, TCP connection, this step as long as the TCP transport connection, there will be. The equivalent of opening a data delivery channel, HTTP is also passed through TCP data, if it is a new connection, then this process is inevitable, also known as the "three-time handshake." If you are using an existing TCP channel, there will be no such step in the HTTP request, which depends on the established connection process, which is generally called a long connection.

3, HTTPS handshake

That is, the HTTPS handshake process, which is used to exchange a series of encrypted information such as certificates, only the HTTPS protocol will be generated, and must have, and this step only exists after each new TCP connection, for already connected or reused before the handshake process, will skip this step. If it is a normal HTTP protocol, there is no such step

4. HTTP Request Header

Contains the request line and header information, all HTTP request methods, all contain these content, so in the HTTP communication process is indispensable.

5. HTTP Request Body

From the common sense, should and the previous step of the header is the HTTP request data, is completely can be combined to send, but the more canonical protocol angle separates them, but this does not affect any resolution, for get no body HTTP request method, there is no this step. It is also why it is mentioned that get speed is relatively fast, but this is almost invisible

6. HTTP Response Header

Same as request, also separate header and body, header this step is necessary, many times even only need HTTP status code to resolve the results

7. HTTP Response Body

In response header only, continue to send response body content, if there is no body, skip this step

8. TCP Close

With a link open, there will also be a closure of the TCP link, and if the contract does not close the link, such as the keep-alive logic in HTTP, the link will remain in the process of subsequent HTTP requests to be reused.

The content of this article is from the cloud talent public number

HTTP protocol Communication Process

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.