简体   繁体   English

如何知道请求是使用 HTTP 1.x 还是 HTTP2 执行的

[英]How to know if a request is performed using HTTP 1.x or HTTP2

I want to know if a request between a JavaScript Client and Node.js server is performed using HTTP1.x or HTTP2.我想知道 JavaScript 客户端和 Node.js 服务器之间的请求是使用 HTTP1.x 还是 HTTP2 执行的。

How I know in XMLHttpRequest, Chrome Console and Node.js what type of protocol is used ?我如何知道在 XMLHttpRequest、Chrome 控制台和 Node.js 中使用了什么类型的协议?

Standard one: performance.timing.nextHopProtocol标准一: performance.timing.nextHopProtocol

Non standard implemetation: window.chrome.loadTimes().connectionInfo非标准实现: window.chrome.loadTimes().connectionInfo

You can check in network tab of dev tools where h2 represents HTTP2,您可以检查开发工具的网络选项卡,其中 h2 代表 HTTP2,

网络面板中的协议列

When the Protocol column says h2 it means that the resource was sent with HTTP/2.协议列显示h2 ,表示资源是通过 HTTP/2 发送的。 The Protocol column is hidden by default.默认情况下,协议列是隐藏的。 Right-click the table header and select Protocol to show it.右键单击表标题并选择协议以显示它。 See Show more information for an example .有关示例,请参阅显示更多信息

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

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