Let's look at the difference between get and post:
(1) Get commit, the requested data will be appended to the URL (that is, the data placed in the HTTP protocol header),
Cut URL and transfer data, multiple parameters with & connection; For example: Login.action?
Name=hyddd&password=idontknow&verify=%e4%bd%a0%E5%A5%BD. If the data is in English letters/numbers
Word, sent as is, if it is a space, converted to +, if it is Chinese/other characters, then directly to the string with BASE64
Encryption, derived as:%E4%BD%A0%E5%A5%BD, where xx in%xx for the symbol in 16 binary representation of the ASCII.
Post submission: Place the submitted data in the package of the HTTP packet.
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 declaration: The HTTP protocol does not limit the size of the transmitted data, the HTTP protocol
The specification also does not limit the URL length.
The main limitations in the actual development are:
GET: Specific browsers and servers have restrictions on URL length, such as IE's limit on URL length is 2083 bytes (2k+35).
For other browsers, such as Netscape, Firefox, etc., theoretically there is no length limit, and its limitations depend on the operating system
The support.
Therefore, for a get commit, the transmitted data is limited by the URL length.
POST: The theoretical data is not limited because it is not transmitted via a URL. But the actual Web server will specify the post submission
The data size is limited, and Apache and IIS6 have their own configurations.
(3) Security:
. The security of post is higher than the security of get. Note: The security described here and the above get mentioned "security" does not
is the same concept. The meaning of "security" above is simply not to make data changes, and the meaning of security here is really
The meaning of security, such as: submit data through get, user name and password will appear in plaintext on the URL, because (1) login
Page may be cached by the browser, (2) Other people can view the browser's history, then others will be able to get your
Account number and password, in addition, using get to submit data may also cause Cross-site request forgery
Attack
(4) TheHTTP GET,POST,SOAP protocol is run on HTTP
1) Get: The request parameter is appended to the URL as a sequence of key/value pairs (query string)
The length of the query string is limited by the Web browser and Web server (ie supports up to 2048 characters
), not suitable for transmitting large datasets at the same time, it's not safe.
2) Post: The request parameter is transmitted in a different part of the HTTP header (named entity body), this part
To transfer the form information, the Content-type must be set to: application/x-www-form-
Urlencoded. The post is designed to support user fields on Web Forms, and its parameters are also transmitted as Key/value
。
However: it does not support complex data types, because post does not define the semantics and rules for transferring data structures.
3) Soap: is a dedicated version of HTTP POST, followed by a special XML message format
Content-type is set to: Text/xml Any data can be XML.
Android access to the database through the network, about the database user name password and other information do not use the HTTP method, because the HTTP method is clear text, where the information is easy to capture the packet. The HTTPS protocol should be used.
Android httpurlconnection connection URL to remember to set the connection timeout, if the network is not good, the Android system will retract the resource interruption operation over the default time.
Soap Brief introduction and Android network connection