current position:Home>Zhang San has a meal - did he eat the difference between get and post in HTTP?
Zhang San has a meal - did he eat the difference between get and post in HTTP?
2022-05-15 02:42:01【Hua Weiyun】
Reading tips : The core content is The scarlet letter , If you want to extract key information, please read the scarlet letter , If you want to see the whole story , Please read in order .
background : It's an ordinary night , It was also an extraordinary night . Late at night , Steamed Rice King ——''POST. Zhang San '' and noodles The emperor ——''GET. Li Si ''( Hereinafter referred to as" : Zhang San po、 Li Si ge), The two brothers were beaten by the big brother of object-oriented programming , Forced to drift to Mount Everest in the computer network —— The five-star Inn on the application layer mountain ——HTTP Inn —— having dinner !!!
Just entered the hotel , A column of prominent slogans at the door of the hotel came into view :
- http1.0 and http1.1 It's all based on TCP/IP Application layer protocol ,GET Methods and POST Methods are sent at the transport layer tcp Message transmission , There is no difference in essence , But in practice , There will be a difference .
Now Zhang San po The student asked : Since there is no difference in essence , Why do you have to divide GET and POST Method ?
Li Si ge: You are so stupid ! Then you usually eat , Why eat with chopsticks and spoon ......
Zhang San po: No , My chopsticks ran away with people last year , In recent years, I only eat with a spoon .
Li Si ge: roll !!!
- transmission tcp message = Zhang San po And Li Si ge The process of eating
- Use POST Method and use GET Method = Eat with a spoon and chopsticks
- Set up POST、GET Purpose : To complete tcp Multiple processing methods are set for transmission message
Li Si ge I'll see you for a long time , So he asked : Don't you know there is something called noodles in the world ? Don't tell me. , You never eat noodles with chopsticks ?
Zhang San po: No , I never eat noodles , I only eat rice , So everyone calls me king of rice —— Zhang San po.
- Spoon = POST chopsticks = GET
- Use POST Submit data = Use a spoon to eat rice
- Use GET Get web information = Use chopsticks to eat noodles
- To deal with different things , Define different methods , Targeted treatment
Zhang San po See Li Si ge Not too smart , So I went straight to the shopkeeper and ordered a bowl Fish bone noodles , Found a place far away from Li Si ge Sit down in the corner and rest , Li Si ge before , Learn Zhang San in a modular way po The appearance of , Ordered a , The super essence version is big Dace rice ball —— Then he sat on Li Si ge side .
The inn is very efficient , Delicious rice balls and hot noodles 10 It'll be on the table in seconds , The two tacitly wolfed down .
Li Si ge Wordy at one breath 3 strip 2 Rice long noodles , But my mouth is not big enough , It can only be clamped off , Divided into two wordy .
Zhang San po: Li Si ge, Do you know how many grains of rice I eat with a spoon ?
Li Si ge: Your rice balls are lump by lump , Directly into a big Body, How do I know how many pills there are ???
Zhang San po: But I can see that you are wordy with chopsticks 3 Noodles !!!
Li Si ge: Why should I let you see me eat some noodles , So that you can ask me this question !!!!!
- The number of grains of rice eaten by a spoon ——POST Data parameters are not visible , The information is filled in Body Partial transmission
- The number of noodles eaten with chopsticks ——GET The data parameters are visible in the address bar , The data parameters are spliced in URL after ( Insecurity )
- There is no rule on how long a mouthful of noodles can only be wordy , But the size of the mouth is limited , Limit the length of wordy noodles ——
- HTTP The standard is not clearly formulated URL The length of , But general browsers support URL The length is , Therefore use GET The transmission of data will receive URL Length limitation .
Li Si ge: I will never forget this night
Zhang San po: Why ? Is it because you are so happy with me that you will never forget it ? I'm so sorry !
- POST The request will not be cached by the browser ( Push agreement )
- GET The request will be cached by the browser ( Pull agreement ), Never forget ~
(hint: The ancestral traditional ceremony of their school , After a meal, you must shout : I'm full ! To show respect for the hard work of the working people ) (hint: Eat noodles , It means there is really no fish bone , Eat the rice balls , May be stuck in the throat , Have to confirm twice )
Ten minutes passed , Li Si ge: I'm full !( Means no fish bones )
Zhang San po Throw the big bowl on the table , Shout : I'm full !
Zhang San po: no ...... no ...... Cough ......ge, Li Si ge I got stuck on a fishbone !!!
- GET Request header and data Send along , With one ~
- POST The request first sends the request header , Wait for the server to respond , Sending data
- When the network environment is good , The time difference between two packets can be ignored , stay Firefox in POST Send the bag only once .
( The food in this shop is unique in the world , People who haven't practiced stomach strength can't digest , Zhang San po I haven't practiced , But Li Si ge Practise )
Soon in Li Si ge With the help of the , Zhang San po Successfully remove the fishbone , But at this moment , Zhang San po My stomach can't digest the dace rice balls in this inn , So my stomach hurts , And Li Si ge But nothing .
- The stomach = The server
- The server needs to get the requested data in a specific way
- The server processes GET Need to pass through Request.QueryString To get data
- The server processes POST Need to pass through Request.Form To get data
After a struggle , Zhang San po Successfully spit out the fish bone just eaten , By the way, at Li Si ge I also vomited a few lumps of rice balls just after my stomach . Li Si ge Felt a trace of pain , He struggled , Hesitating , Shouting , But he still didn't spit out , His stomach gradually became powerful —— How powerful —— Get stronger —— In less than a quarter of an hour , Li Si ge Gained a superpower —— Permanent immunity Zhang San po Vomit attack !!! And zhang SAN po After suffering like hell , Since then, the stomach has been invincible !!!
- Zhang San po Changed the function of the stomach and became more powerful
- Li Si ge Left a permanent immunity
- POST You can modify the resources on the variable server
- GET The requested resource will Actively cached by the browser , Request the same content again , The contents of the cache will be returned
At this time , The innkeeper saw that the two martial brothers were so determined , Morality is so noble , He took out the treasure of the town store —— Pandora's box , Give the two martial brothers a chance to go back to the past ! Back into the store , Have a good night .
Li Si ge In a hurry : You want me to experience it again ??? I might as well be beaten up by object-oriented programming .
Zhang San po: If God gives me another chance to go back to the past , I would say : I am willing to !!!
- POST Request to step back —— Resubmit the request
- GET Request fallback —— No influence ( cache )
Summary
http1.0 and http1.1 It's all based on TCP/IP Application layer protocol ,GET Methods and POST Methods are sent at the transport layer tcp Message transmission , There is no difference in essence , But in practice , There will be a difference .
- Set up POST、GET Purpose : To complete tcp Multiple processing methods are set for transmission message , To deal with different things , Define different methods , Targeted treatment
- POST Data parameters are not visible , The information is filled in Body Partial transmission
- GET The data parameters are visible in the address bar , The data parameters are spliced in URL after ( Insecurity )
- HTTP The standard is not clearly formulated URL The length of , But general browsers support URL The length is , Therefore use GET The transmission of data will receive URL Length limitation .
- POST The request will not be cached by the browser ( Push agreement )
- GET The request will be cached by the browser ( Pull agreement )
- GET Request header and data Send along
- POST The request first sends the request header , Wait for the server to respond , Sending data
- The server needs to get the requested data in a specific way
- The server processes GET Need to pass through Request.QueryString To get data
- The server processes POST Need to pass through Request.Form To get data
- POST You can modify the resources on the variable server
- GET The requested resource will Actively cached by the browser , Request the same content again , The contents of the cache will be returned
- POST Request to step back —— Resubmit the request
- GET Request fallback —— No influence ( cache )
Bloggers try for the first time Story style Explain and introduce knowledge , If there are shortcomings , Welcome comments, private letters, criticism and correction .
copyright notice
author[Hua Weiyun],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/135/202205142117395082.html
The sidebar is recommended
- React error report record
- Analysis of react life cycle function
- react demo1 TodoList
- Summary of the differences between state and props in react
- Difference between controlled components and uncontrolled components in react
- Node. JS use get Stream download file
- How does JavaScript copy arrays instead of references
- JavaScript calculates the number of days, hours, minutes and seconds between days
- JQuery get page address parameters
- JavaScript create Download
guess what you like
node. JS traversal directory
Tips for using JavaScript string split (how to keep the delimiter)
Common CSS notes
JavaScript usage Get the address of the regular function
New generation node JS web development framework koa zero foundation entry learning notes
JavaScript notes
asp. Net core method for modifying HTML without rerun
Summary of compatibility processing of H5 + Vue cli project in Safari browser
Summary of amap scheme of Gaode map used in vue3 + TS project
Summary of filter scheme used in JS code in Vue
Random recommended
- Build an electron project based on Vue from scratch
- In Vue project, solve the problem of verification conflict when eslint and prettier are used at the same time
- Vue3 + vuecli4 solve chunk vendors JS file is too large. Scheme summary
- Scheme summary of eslint check before vue3 + vite configuration project operation and eslint check before git submission
- Fatal authentication failed for 'httpxxxx Git 'solution
- Vue's solution to the compatibility of hevc encoded video in each end browser
- Record the solution to the error in obtaining the picture in springboot in Vue
- [Vue] detailed analysis of the life cycle function of Vue components
- [Vue] deeper understanding of user-defined attribute props
- [Vue] front end error: cannot read properties of undefined (reading 'split')
- [Vue] asynchronous problem of component value transfer -- the sub component gets the data slowly
- [Vue] Vue data changes, but the page is not updated in real time
- [element UI] use of form verification -- detailed explanation
- [Vue] use of slots - Review
- The influence on the fixed positioning element of the inner layer when the outer element has a fixed height and overflows and rolls
- Precautions
- Change detection strategy of angular component
- Angular service and @ injectable
- JS, HTML and CSS are not compatible and do not use common knowledge
- Properties to be known in angular @ component
- Angular acquisition and operation DOM
- Html2canvas problem
- Use day in Vue JS (time and date processing library)
- Vue cli configuring preprocessor global variables (take less as an example)
- How to use H5 custom tags in Vue?
- Come on, vue2 customize global loading
- Come on, Vue move the end suspension ball assembly
- React routing foundation and transmission parameters
- Come on, Vue graphic verification code component
- JavaScript judges browser types and kernels at home and abroad (including 360, QQ, Sogou, etc.)
- ArcGIS JavaScript 4. Generates a rectangular buffer at the point of X
- Node under window JS installation, environment configuration, setting Taobao image
- Understanding of prototype and prototype object of JavaScript
- How to customize the startup port of react project!
- Why vue3 0 using proxy to realize data listening 2021-06-21
- Front end artifact - download, configuration and use process of Charles (vase) [Mac version]
- React next configures SVG loader and supports SVG configurability
- React native Android phone cannot be opened after installation. Flash back!
- Fetch and Axios failed to request on Android, with error messages: network request failed and network error
- How to upgrade react Babel 7.1.0