为什么说"HTTP是无状态协议"?
问题说明
HTTP具有HTTP Cookie. Cookies使服务器可以跟踪用户状态,连接数,最后连接等.
HTTP has HTTP Cookies. Cookies allow the server to track the user state, the number of connections, last connection, etc.
HTTP具有持久连接(保持活动),可以从同一TCP连接发送多个请求.
HTTP has persistent connections (Keep-Alive) where several requests can be sent from the same TCP Connection.
正确答案
即使可以通过同一个HTTP连接发送多个请求,服务器也不会对通过同一套接字到达的请求赋予任何特殊含义.这纯粹是一种性能,旨在最大程度地减少为每个请求重新建立连接所花费的时间/带宽.
Even though multiple requests can be sent over the same HTTP connection, the server does not attach any special meaning to their arriving over the same socket. That is solely a performance thing, intended to minimize the time/bandwidth that'd otherwise be spent reestablishing a connection for each request.
就HTTP而言,它们仍然是单独的请求,必须自行包含足够的信息才能满足请求.那就是无国籍"的本质.如果服务器不知道某些共享信息,则请求将不会彼此关联,在大多数情况下,这些信息是cookie中的会话ID.
As far as HTTP is concerned, they are all still separate requests and must contain enough information on their own to fulfill the request. That is the essence of "statelessness". Requests will not be associated with each other absent some shared info the server knows about, which in most cases is a session ID in a cookie.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfjgjh
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20