The difference between the Http request get and Post

Source: Internet
Author: User

There is also a significant difference between get and post, which simply says:

Get generates a TCP packet; Post generates two TCP packets.

The long said:

For the Get mode request, the browser will send the HTTP header and data in a concurrent delivery, the server response 200 (return data);

For post, the browser first sends the header, the server responds to the continue, the browser sends the data, and the server responds with a $ OK (return data).

In other words, get only need a car to run a trip to the goods sent to, and post to run two times, the first trip, first go and the server to say hello "Hi, I will send a batch of goods, you open the door to greet me", and then back to the goods sent to the past.

Because post takes two steps, it consumes a bit more time and looks like get is more efficient than post. So the Yahoo team recommends using get to replace post to optimize site performance. But this is a pit! Jumping in requires caution. Why?

1. Both get and post have their own semantics and cannot be mixed.

2. According to research, in a good network environment, the time to send a packet and two times the time difference between packets can be ignored. In the case of poor network environment, two packets TCP has a great advantage in verifying the integrity of packets.

3. Not all browsers will send two packets in post, and Firefox will send them only once.

The difference between the Http request get and Post

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.