Learning note sharing (1), the way the post is sent in the HTTP protocol and the Get mode

Source: Internet
Author: User

In the HTTP protocol, there are some differences between post requests and get requests, just some of them. Confused for a while, the novice can avoid the pit.

    1. The format of the transfer of parameters:

Post

The request parameter in the POST request is passed in the request body, which is plainly the content.

This is passed in the "name=abc&password=123" request body.

Get

The request parameter in a GET request is passed in the form of a URL concatenation (request line) (http://www.bilchin.com/message?name=abc&password=123)


Note that the parameters must be noted, there are no spaces and other characters will cause ambiguity, so to the end of the stitching of the URL urlencode.encode () coding Oh.


--------------------------------------------------------------------------------------------------------


2. Usage scenarios:

Post

Let me just say, "post" and "get" are the equivalent of the database "add" and "check",

We do not want the information to be disclosed when we need to upload the user information and this is an "increase" operation, so use the POST request,

Get

Similarly, (a music player) when we click the Play button, we need to find this audio file to play, did not say you want to hide the file name with others, right? Http://www.bilchin.com/message?song= you are my beloved girl. mp3


--------------------------------------------------------------------------------------------------------

3. Parameter size limit

Post:

Can pass the content of large parameters (user feedback information does not count?) )

Get:

If you use the Get method, you are constrained by a length of 2048 bytes, minus the number of characters in the actual path.
(Note: The actual string length that can be used =2048-Request page path character length)

--------------------------------------------------------------------------------------------------------


These 3 points are clear and basically can meet your needs, and others you further study it yourself.


It's 0:16, so sleepy,!!!!!!!!!.

This article is from the "sharing is the best memory" blog, please be sure to keep this source http://elyar.blog.51cto.com/9864306/1766944

Learning note sharing (1), the way the post is sent in the HTTP protocol and the Get mode

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.