当前位置:网站首页>Get post: do you really know the difference between requests??????
Get post: do you really know the difference between requests??????
2022-06-24 09:07:00 【Secret Shura】
The official said above Get post: Differences in requests :( After reading the red font )
GET It is harmless when the browser is backout , and POST The request will be submitted again .
GET Produced URL The address can be Bookmark, and POST Can not be .
GET The request will be initiated by the browser cache, and POST Can't , Unless manually set .
GET Request can only proceed url code , and POST Supports a variety of coding methods .
GET The request parameters are fully preserved in the browser history , and POST The parameters in are not retained .
GET Request in URL There is a length limit on the parameters passed in , and POST It has a .
The data type for the parameter ,GET We only accept ASCII character , and POST There is no limit to .
GET Than POST It's not safe , Because the parameters are directly exposed to URL On , So it can't be used to convey sensitive information .
GET Parameters through URL Pass on ,POST Put it in Request body in .
But what I said Get post It's true ?
GET and POST What is it? ?HTTP Two ways to send requests in the protocol .
HTTP What is it? ?HTTP Is based on TCP/IP Protocol for how data is communicated on the world wide web .
( Key points )HTTP The bottom is TCP/IP. therefore GET and POST The bottom layer is also TCP/IP, in other words ,GET/POST All are TCP link .GET and POST You can do the same thing . Do you want to GET add request body, to POST close url Parameters , Technically, it's perfectly possible .
Request Body What is it? ?@Request Body The role of json Format data to java object .
TCP Like a cargo ship , We use it TCP To transmit data , It is very reliable , It never happens that fewer pieces are lost . But if all the rivers look the same cargo ships , The whole transportation system will be paralyzed because it is difficult to distinguish . To avoid that , Transportation rules HTTP The birth of .
Popular said :http It's just a rule
HTTP Divide the transportation into several categories , Yes GET, POST, PUT, DELETE wait ,HTTP Regulations , When executed GET On request , The cargo ship should be affixed with GET The label of ( Set up method by GET), And it requires that the transmitted data ** streaking ( Don't pretend )** Put it in the hull (url in ) To facilitate recording . If it is POST request , It's going to be pasted on the car POST The label of , And put the goods in the container . Of course , You can also be in GET When I was in the middle of the ship, I hid some containers to load the goods , But it was disgraceful ( It's a bit like smuggling ); It can also be in POST Also put some data on the container , It feels silly .HTTP It's just a code of conduct , and TCP It's just GET and POST How to achieve the basic .
however , We only see HTTP Yes GET and POST Parameter transmission channel (url still requrest body) Put forward a request .“ The standard answer ” Where does the parameter size limit come from ?
In the world wide web , There is another important role : Cargo terminal . Different browsers ( launch http request ) And the server ( Accept http request ) Just different shipping companies . Although theoretically , You can pile unlimited loads on the roof (url And an infinite number of arguments ). But transportation companies are not stupid , Loading and unloading are also very costly ,( Every big wharf is very smart ), They will limit the number of shipments to limit the risk , Too much data is a burden on both the browser and the server . The unwritten rule in the industry is ,( majority ) Browsers often restrict url The length is in 2K Bytes , and ( majority ) Maximum server processing 64K The size of url. More than , We will not deal with it . If you use GET service , stay request body Hiding the data , Different servers do different things , Some servers will unload for you , Read the data , Some servers just ignore it , therefore , although GET You can take request body, There is no guarantee that it will be received .
Okay , Now you know ,GET and POST It's essentially TCP link , There is no difference . But because of HTTP The rules and browsers / Server limitations , As a result, they show some differences in the application process .
Our big BOSS Still waiting to show up ...
the BOSS How mysterious ? When you try to find “GET and POST The difference between ” When , In the search results you'll see , Never mentioned him . What on earth is he ...
http It's just a rule GET and POST There is another important difference , To put it simply :
GET Produce a TCP Data packets ;POST Produce two TCP Data packets .
Long talk :
about GET Method request , The browser will http header and data Send along , Server response 200( Return the data );
And for POST, Browser sends first header, Server response 100 continue, The browser sends data, Server response 200 ok( Return the data ).
in other words ,GET It only takes a transport ship to deliver the goods , and POST Have to run two , The first trip , Airship Go and say hello to the server first “ hi , I have to deliver a shipment later , You open the door to meet me ”, Then go back and deliver the goods .
because POST Two steps are needed. , It takes a little more time , look GET Than POST More effective . therefore Yahoo The team has recommended GET Replace POST To optimize website performance . But this is a pit ! Jump in with caution . Why? ?
GET And POST Each has its own semantics , You can't mix them .
According to research , In a good network environment , The difference between the time to send a packet and the time to send two packets is negligible . And in the case of bad network environment , The two packages TCP On verifying packet integrity , It has great advantages .
Not all browsers will be there POST Send two packets in ,Firefox Just send it once .
Now? , When the interviewer asks you “GET And POST The difference between ” When , Is that the way you are inside ?
For the original text, please refer to
https://www.cnblogs.com/logsharing/p/8448446.html
边栏推荐
- 基于单片机开发的酒精浓度测试仪方案
- Installation of sophus package in slam14 lecture
- Pytorch读入据集(典型数据集及自定义数据集两种模式)
- 520. detect capital letters
- 110. 平衡二叉树-递归法
- A tip to read on Medium for free
- What is graph neural network? Figure what is the use of neural networks?
- 216. combined summation III enumeration method
- Threejs glow channel 01 (unrealbroompass & layers)
- 【Pytorch基础教程31】YoutubeDNN模型解析
猜你喜欢
Redis implements a globally unique ID
Wan Weiwei, a researcher from Osaka University, Japan, introduced the rapid integration method and application of robot based on WRS system
Leetcode -- wrong set
Matlab camera calibrator camera calibration
Transplantation of xuantie e906 -- fanwai 0: Construction of xuantie c906 simulation environment
陆奇:我现在最看好这四大技术趋势
听说你还在花钱从网上买 PPT 模板?
Data midrange: detailed explanation of the technical stack of data acquisition and extraction
Mba-day25 best value problem - application problem
What is graph neural network? Figure what is the use of neural networks?
随机推荐
Common emoticons
Prompt code when MySQL inserts Chinese data due to character set problems: 1366
Matlab camera calibrator camera calibration
Change SSH port number
Array opposite pointer series
MySQL | view notes on Master Kong MySQL from introduction to advanced
【LeetCode】415. String addition
uniapp 开发多端项目如何配置环境变量以及区分环境打包
What is SRE? A detailed explanation of SRE operation and maintenance system
Huawei Router: GRE Technology
[Niuke] length of the last word of HJ1 string
Analyze the meaning of Internet advertising terms CPM, CPC, CPA, CPS, CPL and CPR
The form image uploaded in chorme cannot view the binary image information of the request body
Kaformer personal notes
Data middle office: overview of data governance
怎么把mdf和ldf文件导入MySQL workbench中
【输入法】迄今为止,居然有这么多汉字输入法!
[noi Simulation Competition] send (tree DP)
Solution: the word of jmeter5.5 on the win11 lower interface is very small
MySQL - SQL statement