简体   繁体   English

Chrome扩展程序chrome.webRequest API-请求标题中未包含一些http请求标题

[英]Chrome extension chrome.webRequest API - Some http request headers not coming in request headers

I was working on chrome extension with motive of intercepting all HTTP(S) requests/responses and log all headers into persistent file (on disk). 我正在进行chrome扩展,目的是拦截所有HTTP(S)请求/响应并将所有标头记录到持久文件(在磁盘上)中。 I was almost close to my goal. 我快要实现目标了。 But when I looked some requests closely, I found that in many requests " If-None-Match " and " If-Modified-Since " are missing in requestHeaders . 但是,当我仔细查看一些请求时,发现在很多请求中, requestHeaders都缺少“ If-None-Match ”和“ If-Modified-Since ”。 Though, I can see them in Network panel displayed by the Developer Tools. 不过,我可以在开发人员工具显示的“网络”面板中看到它们。

I tried hard to figure out any patterns, causing such behavior. 我尽力找出可能导致这种现象的任何模式。 But, unfortunately there is no such pattern. 但是,不幸的是,没有这种模式。

Anybody please help. 有人请帮忙。

The receive the list of requestHeader is necessary to use the onBeforeSendHeaders event from chrome.webRequest API . 要使用chrome.webRequest API中onBeforeSendHeaders事件,必须接收requestHeader列表。

In the onBeforeSendHeaders description is mentioned that some headers are not available for reading/processing: onBeforeSendHeaders描述中提到某些标头不可用于读取/处理:

  • Authorization 授权
  • Cache-Control 缓存控制
  • Connection 连接
  • Content-Length 内容长度
  • Host 主办
  • If-Modified-Since 如果-Modified-Since的
  • If-None-Match 如果 - 无 - 匹配
  • If-Range 如果量程
  • Partial-Data 局部数据
  • Pragma 附注
  • Proxy-Authorization 代理授权
  • Proxy-Connection 代理连接
  • Transfer-Encoding 传输编码

I'm afraid you will not be able to read or modify these headers, because it's an API forced limitation. 恐怕您将无法读取或修改这些标头,因为这是API的强制限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM