如何知道请求是使用 HTTP 1.x 还是 HTTP2 执行的
How to know if a request is performed using HTTP 1.x or HTTP2
我想知道 JavaScript 客户端和 Node.js 服务器之间的请求是使用 HTTP1.x 还是 HTTP2 执行的。
我怎么知道 XMLHttpRequest、Chrome 控制台和 Node.js 使用什么类型的协议?
标准一:performance.timing.nextHopProtocol
非标准实现:window.chrome.loadTimes().connectionInfo
您可以查看开发工具的网络选项卡,其中 h2 代表 HTTP2,
当 Protocol 列显示 h2
时,这意味着资源是通过 HTTP/2 发送的。 Protocol 列默认隐藏。 Right-click table header 和 select 协议 来显示它。参见 Show more information for an example。
我想知道 JavaScript 客户端和 Node.js 服务器之间的请求是使用 HTTP1.x 还是 HTTP2 执行的。
我怎么知道 XMLHttpRequest、Chrome 控制台和 Node.js 使用什么类型的协议?
标准一:performance.timing.nextHopProtocol
非标准实现:window.chrome.loadTimes().connectionInfo
您可以查看开发工具的网络选项卡,其中 h2 代表 HTTP2,
当 Protocol 列显示 h2
时,这意味着资源是通过 HTTP/2 发送的。 Protocol 列默认隐藏。 Right-click table header 和 select 协议 来显示它。参见 Show more information for an example。