Is there a way to force an XMLHttpRequest to use HTTP/1.1?

三世轮回 提交于 2020-01-25 09:37:06

问题


I have a server endpoint that supports both HTTP/1.1 and HTTP2. For testing purposes, I want to try downloading content from the endpoint with both HTTP/1.1 and HTTP2 connections, possibly at the same time.

When I request data from the endpoint with an XMLHttpRequest, it automatically uses HTTP2, without me including the Connection: Upgrade header.

Is there a way to force an XMLHttpRequest to use HTTP/1.1 for the underlying TCP connection? What about other protocols, such as Quic or SPDY?


回答1:


No.

From Remy Lebeau's comment:

The browser decides which protocol it wants to use as an implementation detail of the XmlHttpRequest object. You can't force a particular choice from inside your script.



来源:https://stackoverflow.com/questions/56675358/is-there-a-way-to-force-an-xmlhttprequest-to-use-http-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!