HTTP protocol [get and post] detailed

Source: Internet
Author: User

HTTP defines the different methods of interacting with the server, the most commonly used are 4, Get, Post, Put, delete,put (Increase), delete (delete), Post (change), Get (check), that is, add and remove changes for Delete and Put almost do not introduce:

1) Get, which is used to get information, note that he just gets and queries the data, that is, it does not modify the data on the server, from this point, it is data security, and later mentioned post it can modify the data, so this is one of the differences.

2) post, it is possible to send a modification request to the server, thus modifying the server, for example, we want to post on the Forum, comments on the blog, this will be used to post, of course, it can only get the data

    • GET-Requests data from the specified resource.
    • POST-submits the data to be processed to the specified resource get method

      Note that the query string (name/value pair) is sent in the URL of the GET request:

      /test/demo_form.asp?name1=value1&name2=value2

      Some additional comments about the GET request:

      • Get requests can be cached
      • GET requests remain in browser history
      • Get requests can be bookmark-Favorites
      • GET requests should not be used when handling sensitive data
      • Get request has a length limit
      • GET requests should only be used to retrieve data
      • POST method

        Note that the query string (name/value pair) is sent in the HTTP message body of the POST request:

        Post/test/demo_form.asp http/1.1host:w3schools.comname1=value1&name2=value2

        Some additional comments about the POST request:

        • POST requests are not cached
        • POST requests are not persisted in browser history
        • POST cannot be bookmarked
        • POST request has no requirement for data length
        • The data for a GET request is placed in the HTTP header, which is followed by a URL, usually as defined in the following format ( and post is the submitted data in the HTTP body ).

          Login.action?name=hyddd&password=idontknow&verify=%e4%bd%e5%a5%bd

          A, to? To separate URLs and data;

          B, with & to separate the parameters;

          C, if the data is English or digital, sent as is;

          D, if the data is in Chinese or other characters, it is BASE64 encoded.

          2) Get submitted less data, up to 1024B, because the get data is attached to the URL, and the URL will be subject to different circumstances, such as IE limit to 2k+35, and post can transmit more data (theoretically unlimited, but generally will be affected by different environments, such as browser, operating system, server processing power limit, IIS4 can support 80KB,IIS5 can support 100KB).

          3) post security is higher than get, because the parameter data is transmitted in clear text when get, and can also cause Cross-site request forgery attack using get. The post data can be encrypted, but get may be faster.

          So, summarize the following table:

          Operation mode

          Data location

          Vmcontext

          Data security

          Length limit

          Application Scenarios

          GET

          HTTP Header

          Plaintext

          Not safe

          Small length

          Querying data

          POST

          HTTP body

          Can be clear and dense

          Safety

          Supports large data transfer

          modifying data

            • Summarize

              Access HTTP resources with GET and post---

              · Get requests submit data placed in the HTTP request protocol header (that is, the URL), while the data submitted by the post is placed in the Entity data, security is relatively high.
              · The Get method submits only 1024 bytes of data, while Post does not have this limit

              There are two ways to transfer data in different ways. Flexible operation of Get and post based on different server-defined request access methods.

HTTP protocol [get and post] detailed

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.