当前位置:网站首页>Web Security (V) what is a session? Why do I need a session?
Web Security (V) what is a session? Why do I need a session?
2022-07-06 05:28:00 【jinyangjie0】
Session What is it?
Session Is the meaning of conversation , It is generally used to record user information on the server . It made up for HTTP It is the defect of stateless protocol that makes the service unable to identify users .
The typical scene is a shopping cart , When you want to add items to the cart , The system doesn't know which user operated , because HTTP Protocol is stateless . The server creates specific Session
Then you can identify the user and track the user .
Why session
Talk about session Usually in web In the context of application , We know web The application is based on HTTP Agreed , and HTTP The agreement is exactly a stateless agreement . in other words , User from A The page jumps to B The page will be sent again HTTP request , When the server returns the response, it cannot know that the user is requesting B What did you do before the page .
about HTTP The cause of Statelessness , relevant RFC There is no explanation in , But contact HTTP History and application scenarios , We can infer some reasons :
1、 Design HTTP The original purpose is to provide a release and reception HTML Page method . At that time, there was no dynamic page technology , Only pure static HTML page , Therefore, there is no need for the agreement to maintain the state ;
2、 When the user receives a response , It often takes some time to read the page , Therefore, if the connection between the client and the server is maintained , Then this connection will be idle most of the time , This is an unprovoked waste of resources . therefore HTTP The original design is the default short connection , That is, the client and server disconnect after completing a request and response TCP Connect , Therefore, the server cannot predict the next action of the client , It doesn't even know if this user will visit again , So let HTTP Protocols to maintain user access status are also completely unnecessary ;
3、 Transfer part of the complexity to HTTP Protocol based technology can make HTTP It is relatively simple at the level of agreement , And this simplicity also gives HTTP Stronger scalability . in fact ,session Technology is also right in essence HTTP An extension of the protocol .
To make a long story short ,HTTP The statelessness of is determined by its historical mission . But with the vigorous development of network technology , People are no longer satisfied with rigid and boring static HTML, They hope web Application can move , So scripts and DOM technology ,HTML Added form in , And the server appears CGI Dynamic technology .
边栏推荐
- GAMES202-WebGL中shader的编译和连接(了解向)
- Set detailed map + interview questions
- 【OSPF 和 ISIS 在多路访问网络中对掩码的要求】
- How to get list length
- 趋势前沿 | 达摩院语音 AI 最新技术大全
- Golang -- TCP implements concurrency (server and client)
- flutter 实现一个有加载动画的按钮(loadingButton)
- Codeforces Round #804 (Div. 2) Editorial(A-B)
- February 12 relativelayout
- C进阶-数据的存储(上)
猜你喜欢
29io stream, byte output stream continue write line feed
Simple understanding of interpreters and compilers
初识CDN
Pointer classic written test questions
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
[leetcode16] the sum of the nearest three numbers (double pointer)
趋势前沿 | 达摩院语音 AI 最新技术大全
28io stream, byte output stream writes multiple bytes
自建DNS服务器,客户端打开网页慢,解决办法
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
随机推荐
毕业设计游戏商城
Steady, 35K, byte business data analysis post
Principle and performance analysis of lepton lossless compression
【华为机试真题详解】统计射击比赛成绩
Ora-01779: the column corresponding to the non key value saving table cannot be modified
Yyds dry inventory SSH Remote Connection introduction
nacos-高可用seata之TC搭建(02)
Excel转换为Lua的配置文件
03. 开发博客项目之登录
浅谈镜头滤镜的类型及作用
[mask requirements of OSPF and Isis in multi access network]
ByteDance program yuan teaches you how to brush algorithm questions: I'm not afraid of the interviewer tearing the code
图数据库ONgDB Release v-1.0.3
[detailed explanation of Huawei machine test] statistics of shooting competition results
Nacos - TC Construction of High available seata (02)
Golang -- TCP implements concurrency (server and client)
Vulhub vulnerability recurrence 68_ ThinkPHP
Mongodb basic knowledge summary
Select knowledge points of structure
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower