Get,post differences, HTTP communication

Source: Internet
Author: User

GET & POST
GET
The essence of 1.GET is "get"
2. Get data from the server, more efficient
3. From a mathematical point of view, the result of GET is "idempotent"
4.GET requests can be cached
5. In the HTTP protocol definition, there is no data size limit for GET requests, but because the browser is different, the general limit is between 2~8k
6. All the parameters are wrapped in the URL, and the server's access log is logged, do not pass sensitive information
Parameter format? Add at the end of the resource path? Represents the append parameter variable name = variable value each variable and value is set according to the "Variable name = Variable Value" method, and cannot contain a space or a special symbol such as Chinese.
& Multiple parameters Use & Connect
POST
The essence of 1.POST is "give"
2. Send data to the server, you can also get the result after the server processing, less efficient than get
3.POST request cannot be cached, post submits data again, the page will be prompted: whether to send data .....
Post submission data is larger, size is limited by server setpoint, PHP is usually limited to 2M
In the URL, only the resource path, but not the parameters, the server log does not log parameters and is relatively more secure
Parameters are packaged into binary data bodies, and the format is basically the same as get, just not included?
All data designed for user privacy (password, bank card number) Be sure to remember to use the Post method to pass
-------------------------------------------------------------------------------------

HTTP Communication Process-Request

The NHTTP protocol stipulates that a complete HTTP request sent by the client to the server contains the following content request line: Contains the request method, the request resource path, the HTTP protocol version

Get/mjserver/resources/images/1.jpg http/1.1

Request Header: Contains information about the client's environment description, the host address requested by the client, and so on

host:192.168.1.105:8080// the server host address that the client wants to access

user-agent: mozilla/5.0 (Macintosh; Intel Mac OS X 10.9) firefox/30.0

Client-type, client-side software environment

Accept:text/html, the type of data that the */*//client can receive

ACCEPT-LANGUAGE:ZH-CN//Client language environment

Accept-encoding:gzip//client-supported data compression formats

P Request body: Specific data that the client sends to the server, such as file data

===========

HTTP Communication Process-response

n When the client sends a request to the server, the server should respond by returning the data to the client Nhttp Protocol: A full HTTP response contains the following P status line: contains the HTTP protocol version, status code, status English name

http/1.1 OK

P Response Header: Contains a description of the server, a description of the returned data

server:apache-coyote/1.1//Type of server

Content-type:image/jpeg//type of return data

content-length:56811//length of returned data

Date:mon, June 12:54:52 GMT//Response time

P Entity content: Specific data that the server returns to the client, such as file data


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

200 (status code) OK
2XX success

4XX Client Error
5xx Server-side error

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

Get,post differences, HTTP communication

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.