Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between GET and POST in the way HTTP requests

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "what is the difference between GET and POST in the request mode of HTTP". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope this article "what is the difference between GET and POST in the request mode of HTTP" can help you solve the problem.

Two common request methods of HTTP, GET and POSTHTTP:HTTP Protocol (HyperText Transfer), are used to transfer hypertext from a World wide Web (WWWW:World Wide Web) server to a local browser. HTTP is a communication protocol based on TCP/IP to transfer data (HTML files, picture files, query results, etc.). 1. GET method

When using the GET method, the query string (name or key-value pair) is sent in the URL of the GET request:

/ test/demo_form.php?name1=value1&name2=value2 indicates that POST requests will not be cached. POST requests will not be retained in browser history. URL of POST requests cannot be stored as bookmarks. POST requests have no length and require HTTP. It is more reliable for POST to transmit data to the background. The POST method packages information in the same way as the GET method, but the POST method does not use the information as a URL? The text string after the character is sent, but the information is sent as a separate message. Servlet uses the doPost () method to handle this type of request. 3. The difference between the GET method and the POST method when the browser performs a fallback operation, the GET request is harmless, while the POST request will re-request that the GET request parameters are connected after the URL, while the POST request parameters are stored in the message body (Requestbody). The GET request limits the number of parameters because the browser has a limit on the length of the url (different browsers have different limits). For post requests, there is no limit on the number of parameters because the parameters are stored in Requestbody. Because GET request parameters are exposed on URL, POST is more secure than GET. GET request browsers will actively cache (Cache), but POST will not. Unless actively setting GET request parameters will be saved in browser history, POST requests will not only be URL-encoded. While POST requests can support multiple encoding methods, GET requests can generate 1 Tcp packet, and POST requests generate 2 Tcp packets. When sending a GET request, the browser sends the request header (Header) and data (Data) to the server. The server returns 200status code. When sending the POST request, the Header is sent to the server, and the server returns 100. then the server sends the Data to the server. The server returns 200instructions:

GET requests can be cached

GET requests are kept in the browser history

The URL requested by GET can be collected as a bookmark

GET requests should not be used when processing sensitive data

GET request has a length limit

GET requests should only be used to obtain data

The GET method, the default request method for passing information from the browser to the Web server, produces a long string that appears in the browser's address bar. The GET method has a size limit: there is a maximum of 1024 characters in the request string. Servlet

2. POST method

When using the POST method, the query string (name or key-value pair) is resent at the HTTP message body of the POST request: this type of request is processed using the doGet () method.

POST / test/demo_form.php HTTP/1.1Host: runoob.comname1=value1&name2=value2 description

POST requests will not be cached

POST requests are not retained in the browser history

The URL requested by POST cannot be bookmarked

POST request has no length requirement

In the method of HTTP, it is more reliable for POST to transmit data to the background. The way of packing information in POST method is basically the same as that in GET method, but the POST method does not regard the information as URL? The text string after the character is sent, but the information is sent as a separate message. Servlet uses the doPost () method to handle this type of request.

3. The difference between GET method and POST method.

When the browser performs a fallback operation, the GET request is harmless, while the POST request is requested again

GET request parameters are connected after URL, while POST request parameters are stored in the message body (Requestbody)

GET requests have restrictions on the number of parameters passed because browsers have restrictions on url length (different browsers have different length limits), while post requests have no limit on the number of parameters because the parameters are stored in the Requestbody.

Because the GET request parameters are exposed on URL, POST is more secure than GET in terms of security

GET request browser will actively cache (Cache), POST will not, unless actively set

GET request parameters are saved in the browser history, but POST requests are not

GET requests can only be encoded with URL, while POST requests can support multiple encodings

The GET request generates 1 Tcp packet, and the POST request generates 2 Tcp packets

When sending a GET request, the browser sends the request header (Header) together with the data (Data) to the server, and the server returns 2000.When sending the POST request, the Header is sent to the server first, and the server returns 100. then the Data is sent to the server.

This is the end of the content about "what is the difference between GET and POST in the way HTTP requests". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report