A brief analysis of the difference between Get and Post

Source: Internet
Author: User
Introduction to Basic requests

Http defines different ways to interact with the server, with 4 basic methods, namely get,post,put,delete.
Get,post,put,delete corresponding to the resources of the search, change, increase, delete 4 operations. Here, you should have a general understanding, get is generally used to get/query resource information, and post is generally used to update resource information. Introduction to URLs

The URL full name is a resource descriptor, which we can think of as: a URL address that is used to describe a resource on a network.
The encoding format of the URL is ASCII, not Unicode, which means that you cannot include any non-ASCII characters in the URL, and all non-ASCII characters need to be encoded and retransmitted, and the URL encoding can be referenced by: HTTP://KB.CNBLOGS.COM/PA ge/133765/. the difference between Get and Post: 1 Form:

(1) The GET request parameter is placed behind the URL (the data is placed in the request line), and the first parameter is used. Stitching, followed by the second parameter, until the last one, separated by &, for example Https://www.baidu.com/s?ie=utf-8&f=3&rsv_bp=1&rsv_idx=1
(2) The parameter of Post is placed inside the request body;
Therefore, the data submitted by get is displayed in the Address bar, and the address bar does not change when the post is submitted. 2 The size of the transmitted data

First of all: the HTTP protocol does not limit the size of the transmitted data, and the HTTP protocol specification does not limit the length of the URL.
So: "Thedata submitted by the Get method can only be 1024 bytes, in theory there is no limit to post, can be transmitted a large amount of data ."
In fact, this is wrong, inaccurate (I was once misled, too young and simple)
the main limitations in actual development are:
(1) GET: A specific browser has a limit on the length of the URL, for example, IE the limit for URL length is 2083 bytes (2k+35). For other browsers, such as Netscape, FireFox, etc., the limitations depend on the support of the operating system. Therefore, for a GET commit, the transmitted data is limited by the URL length.
(2) POST: The theoretical data is not limited because it is not transmitted by the URL. However, the actual WEB server will be required to limit the size of the post submission data, Apache, IIS6 have their own configuration. 3 Security

The security of post is higher than the security of get. Get parameters are exposed in the address bar, and there is a cache (such as the login interface), other people to view the browser's history, you can get login from the cache account and password and other sensitive data, and POST submitted records are not cached. 4 Other

For the Get method, the server uses Request.QueryString to get the value of the variable, and the server uses Request.Form to get the submitted data for the POST request mode.
POST requires a definite method, get is not required, and the default is a GET request. Summary:

Record GET POST
Back/Refresh Harmless The data is resubmitted (the browser should tell the user that the data will be resubmitted).
Bookmark Bookmark can be bookmarked Bookmark not available for collection
Cache can be cached Cannot be cached
History The parameters remain in the browser history. Parameters are not saved in the browser history.
Limits on the length of data The length of the URL is limited by the browser The data length is limited by the server
Restrictions on data types Only ASCII characters are allowed. There is no limit. Binary data is also allowed.
Security GET is less secure because the data being sent is part of the URL. POST is more secure than GET because parameters are not saved in the browser history or Web server logs.
Visibility of The data is visible to everyone in the URL. The data is not displayed in the URL.
Finally, the restrictions on URLs for each browser
Browser maximum number of bytes
Ie 2083
Firefox 65,536
Chrome 8182
360 Speed Browser 2118
Safari 80,000
Opera 190,000
Reference Blog/material:

http://blog.csdn.net/gideal_wang/article/details/4316691
Http://www.cnblogs.com/hyddd/archive/2009/03/31/1426026.html
Http://www.baiwar.com/post/the-maximum-length-of-the-url-in-the-browser-get-request-limits.html
Http://www.w3school.com.cn/tags/html_ref_httpmethods.asp
http://blog.csdn.net/yang_5/article/details/8174889 Description:

This blog belongs to their own understanding, if there are errors, welcome to shoot bricks. Thank you.

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.