• 一步
    2019-06-07
    浏览器启动缓存后,下次请求的时候,缓存有的来自 from disk cache , 有的来自 from memory cache,这个静态资源是根据什么来选择缓存的位置的呢?

    作者回复: 比较复杂,根据资源类型、隐私策略、各浏览器的设计哲学等而定,例如chrome官方文档曾经这么描述:“Chrome employs two caches — an on-disk cache and a very fast in-memory cache. The lifetime of an in-memory cache is attached to the lifetime of a render process, which roughly corresponds to a tab. Requests that are answered from the in-memory cache are invisible to the web request API. If a request handler changes its behavior (for example, the behavior according to which requests are blocked), a simple page refresh might not respect this changed behavior. To make sure the behavior change goes through, call handlerBehaviorChanged() to flush the in-memory cache. But don't do it often; flushing the cache is a very expensive operation. You don't need to call handlerBehaviorChanged() after registering or unregistering an event listener.”

    
     6
  • 一步
    2019-06-07
    有个问题 就是,我把 disable cache 关闭了,在 wireshark 中 抓去 host ss1.bdstatic.com 请求,发现没有应用层的请求,都是 TLS 或者 TCP 这是为什么啊?

    作者回复: 因为http请求被TLS加密了,wireshark作为中间人无法解密出http格式的消息。第3部分第3课会介绍wireshark如何解密chrome中的TLS消息

    
     4
  • 郭凯强
    2019-10-29
    老师 ,针对缓存过期我不是很明白。client先判断缓存已经过期了,获取了标签,再将标签发送给server。这时候明明已经过期了,为什么视频中还会说server判断缓存没过期,则返回给client304呢?

    作者回复: 虽然缓存已经过期,但client想问问看过期的缓存能不能用,因为server如果发现资源到现在仍然没变化,那么缓存就仍然可以用,因为304要比200有效率多了,通常http body都要远大于header

    
     2
  • 张迪
    2019-07-19
    http不是无状态的协议吗,服务器还会保存指纹?

    作者回复: 指纹是实时生成的,比如文件大小+最后访问时间

    
     1
我们在线,来聊聊吧