Differences between http get and post requests and getpost requests

Source: Internet
Author: User

Differences between http get and post requests and getpost requests

Whether a request calls servlet's doGet or doPost does not depend on httbench vlet. No Default call method is provided. If your request is get, you can call doGet. If your request is post, you can call doPost. Enter a url in the browser. By default, this request is get in the browser. It is not explicitly indicated in the form that it is also the default get. This is the browser specification and html specification, not to say which one is called by HTTPServlet by default.

2. post and get

1. Common differences:

(1) GET is harmless when the browser rolls back, and POST will submit the request again.

(2) The URL generated by GET can be Bookmark, but not POST.

(3) The GET request will be automatically cached by the browser, but the POST will not, unless manually set.

(4) GET requests can only undergo url encoding, while POST supports multiple encoding methods.

(5) The GET request parameters will be completely retained in the browser history, while the parameters in POST will not be retained.

(6) There is a limit on the length of parameters transmitted by GET requests in the URL, and there is a limit on POST parameters.

(7) For the parameter data type, GET only accepts ASCII characters, but there is no limit on POST.

(8) GET is less secure than POST because parameters are directly exposed to URLs and therefore cannot be used to transmit sensitive information. The GET parameter is passed through the URL, and the POST is placed in the Request body.

2. The bottom layer of HTTP is TCP/IP. Therefore, the bottom layer of GET and POST is TCP/IP, that is, GET/POST is a TCP link. GET and POST can do the same thing. You need to add the request body to GET and url parameters to POST. Technically, the request body is complete. HTTP is only a code of conduct, while TCP is the basic implementation of GET and POST.

3 length limit: tcp is a transport layer protocol with only one packet limit. The total size is not limited, but the size of request data is limited by browsers and servers.

4. get generates a TCP data packet and post generates two data packets: For GET requests, the browser will send the http header and data together, and the server will respond to 200 (return data );

For POST, the browser first sends the header, the server responds to 100 continue, the browser then sends data, and the server responds to 200 OK (data is returned ). (Firefox sends only one request)

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.