HTTP

作者: 郑无穷大 | 来源:发表于2018-07-21 14:32 被阅读0次

1、Cookie 的特点

服务器通过 Set-Cookie 响应头设置 Cookie

浏览器得到 Cookie 之后,每次请求都要带上 Cookie

服务器读取 Cookie 就知道登录用户的信息(email)


问题

cookie 存在的问题:用户可以随意篡改 Cookie。


2、Session 与 Cookie 的关系


(1) cookie

(2)session


(3)LocalStorage


(4)SessionStorage(会话存储)



浏览器缓存详解:expires,cache-control,last-modified,etag


(1)expire是之前前端缓存的方式,区别于cache-control是设置结束时间,但存在用户本地时间错乱。

(2)cache-control和expire的使用:

response.setHeader('Cache-Control','max-age=30000000')

response.setHeader('Expires','Sun, 04 Feb 2018 14:40:05 GM')



HTTP问与答

相关文章

网友评论

      本文标题:HTTP

      本文链接:https://www.haomeiwen.com/subject/jdshmftx.html