[英]incorrect http protocol shown by chrome developer tools?
I am checking the http protcol in use for this site http://www.dlf.in/ Chrome developer tools shows it to be http/1.1 as in the image below. 我正在检查此网站使用的http协议http://www.dlf.in/ Chrome开发者工具显示它为http / 1.1,如下图所示。
However the command line tool is-http2 or alpn in python as seems to indicate the http/1.1 is not available. 但是,命令行工具是 python中的-http2或alpn,似乎表明http / 1.1不可用。 And only http1 is available. 并且只有http1可用。 What's going on here? 这里发生了什么?
I am doing the ALPN negotiation in python as follows (openssl version : OpenSSL 1.0.2h and python version 3.5.1) 我正在以如下方式在python中进行ALPN协商(openssl版本:OpenSSL 1.0.2h和python版本3.5.1)
import ssl
import socket
port = 443
domain = 'www.dlf.in'
ctx = ssl.create_default_context()
ctx.set_alpn_protocols(['h2', 'spdy/3.1', 'spdy/3', 'spdy/2', 'http/1.1'])
conn = ctx.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),
server_hostname=domain)
conn.connect((domain, port))
print(conn.selected_alpn_protocol())
That site doesn't have HTTPS on it. 该站点上没有HTTPS。 Browsers only support HTTP/2 over HTTPS despite the spec allowing it over HTTP in theory. 浏览器仅支持HTTP / 2上的HTTP / 2,尽管该规范理论上允许基于HTTP。
Using telnet
and HTTPie
to send HTTP requests (both 1.0 and 1.1), the web server responds with: 使用telnet
和HTTPie
发送HTTP请求(1.0和1.1),Web服务器将响应:
HTTP/1.1 200 OK HTTP / 1.1 200 OK
I tried it with 2.0 and got: 我用2.0尝试了一下,得到了:
HTTP/1.1 505 HTTP Version Not Supported 不支持HTTP / 1.1 505 HTTP版本
This site doesn't support SSL (I tried using using curl https://www.dlf.in
and got the HTTP 504 response) 该网站不支持SSL(我尝试使用curl https://www.dlf.in
并获得了HTTP 504响应)
Curl is a command line browser that also implements HTTP/2 in clear (non SSL) and it has the upgrade mechanism (using the --http2
flag). Curl是一种命令行浏览器,它也以清晰的方式(非SSL)实现HTTP / 2,并且具有升级机制(使用--http2
标志)。 Using that flag I saw that the website doesn't support clear HTTP/2. 使用该标志,我看到该网站不支持清除HTTP / 2。 (There is an option to connect directly with HTTP/2 in clear, without the upgrade mechanism, using --http2-prior-knowledge
, but it doesn't work either). (有一个选项可以使用--http2-prior-knowledge
以明文形式直接与HTTP / 2直接连接,而无需升级机制,但这也不起作用)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.