HTTP Hypertext Transfer Protocol, get and post differences

Source: Internet
Author: User

A: What is HTTP?

http: Hypertext Transfer Protocol (Http,hypertext Transfer Protocol), which is a standard for client and server-side transmissions, is the application-layer communication protocol. The client is a mid-end user, the server is a Web site, and the server holds many resource files.

Typically, a request is initiated by an HTTP client to establish a TCP connection to the server-specified port (by default, port 80). The HTTP server listens on that port for requests sent by the client. Once the request is received, the server (to the client) sends back a status line, such as "http/1.1 OK", and the (response) message.

Typically HTTP messages include client-to-server request messages and server-to-client response messages. These two types of messages consist of a starting line, one or more header fields, a blank line that indicates the end of the head field, and an optional message body. The header fields of HTTP include the general header, the request header, the response header, and the four parts of the entity header. Each header field consists of a domain name, a colon (:), and a domain value of three parts. Domain names are case-insensitive, you can add any number of whitespace before the domain value, and the header field can be expanded to multiple lines, at the beginning of each line, with at least one space or tab.

Two: the relationship between HTTP and three handshake?

HTTP is the application-layer transport protocol, which always assumes that the data is transferred correctly, and its task is to exchange information with the server.
TCP is the Transport layer protocol, which is secure and reliable. Three handshake will occur to ensure the correctness of the transmission.
The lower level of the application layer is the transport layer, so HTTP will be based on TCP, and three handshake will occur.

Three: HTTP status message:

Website: http://www.w3school.com.cn/tags/html_ref_httpmessages.asp
An error may occur when the browser requests a service from the Web server.
It is possible to return the following series of status messages:

Four: Two methods of HTTP request: GET and POST, what is the difference?

Website: http://www.w3school.com.cn/tags/html_ref_httpmessages.asp

In the request-response between the client and the server, the two most commonly used methods are: GET and POST.
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
1) Some other 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.1
Host:w3schools.com
Name1=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

Compare GET to POST

Five: Other HTTP request methods

HTTP Hypertext Transfer Protocol, get and post differences

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.