http/2 chrome 无法service push问题
Hey there,
我在Mac os-x 使用nginx自建证书,支持https/http2,使用nginx指令
http2_push_preload on;
http2_push /style.css;
推送给客户端style,但是在network面板里面看不到push的结果。通过netlog-views 查看请求发现:
33367 \[st=0\] HTTP2\_SESSION\_RECV\_PUSH\_PROMISE
--> :method: GET
:path: /style.css
:scheme: https
:authority: www.e.com
accept-encoding: gzip, deflate, br
accept-language: zh,en;q=0.9,zh-CN;q=0.8,zh-TW;q=0.7,da;q=0.6
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
--> id = 3
--> promised\_stream\_id = 4
t=33367 \[st=0\] HTTP2\_SESSION\_SEND\_RST\_STREAM
--> description = "Duplicate pushed stream with url: https://www.e.com/style.css"
--> error\_code = "7 (REFUSED\_STREAM)"
--> stream\_id = 4
t=33367 \[st=0\] HTTP2\_SESSION\_RECV\_HEADERS
--> fin = false
--> :status: 200
server: nginx/1.17.1
date: Mon, 28 Oct 2019 12:53:50 GMT
content-type: text/html
content-length: 614
last-modified: Mon, 28 Oct 2019 12:18:43 GMT
etag: "5db6dca3-266"
accept-ranges: bytes
--> stream\_id = 3
这里奇怪的提示:
Duplicate pushed stream with
有两个疑问:
- 为什么Duplicate了呢?
- 为什么这帧的流id是4,但是请求的流id是3。
求解释~~
完整的log如下:
482506: HTTP2_SESSION
Start Time: 2019-10-28 20:53:50.036
t=33367 [st=0] HTTP2_SESSION_PING
--> is_ack = false
--> type = "sent"
--> unique_id = 1
t=33367 [st=0] HTTP2_SESSION_SEND_HEADERS
--> exclusive = true
--> fin = true
--> has_priority = true
--> :method: GET
:authority: www.e.com
:scheme: https
:path: /
cache-control: max-age=0
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
sec-fetch-mode: navigate
sec-fetch-user: ?1
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
sec-fetch-site: none
accept-encoding: gzip, deflate, br
accept-language: zh,en;q=0.9,zh-CN;q=0.8,zh-TW;q=0.7,da;q=0.6
--> parent_stream_id = 0
--> source_dependency = 483310 (HTTP_STREAM_JOB)
--> stream_id = 3
--> weight = 256
t=33367 [st=0] HTTP2_SESSION_RECV_PUSH_PROMISE
--> :method: GET
:path: /style.css
:scheme: https
:authority: www.e.com
accept-encoding: gzip, deflate, br
accept-language: zh,en;q=0.9,zh-CN;q=0.8,zh-TW;q=0.7,da;q=0.6
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
--> id = 3
--> promised_stream_id = 4
t=33367 [st=0] HTTP2_SESSION_SEND_RST_STREAM
--> description = "Duplicate pushed stream with url: https://www.e.com/style.css"
--> error_code = "7 (REFUSED_STREAM)"
--> stream_id = 4
t=33367 [st=0] HTTP2_SESSION_RECV_HEADERS
--> fin = false
--> :status: 200
server: nginx/1.17.1
date: Mon, 28 Oct 2019 12:53:50 GMT
content-type: text/html
content-length: 614
last-modified: Mon, 28 Oct 2019 12:18:43 GMT
etag: "5db6dca3-266"
accept-ranges: bytes
--> stream_id = 3
t=33368 [st=1] HTTP2_SESSION_RECV_DATA
--> fin = false
--> size = 614
--> stream_id = 3
t=33368 [st=1] HTTP2_SESSION_UPDATE_RECV_WINDOW
--> delta = -614
--> window_size = 15728008
t=33368 [st=1] HTTP2_SESSION_RECV_DATA
--> fin = true
--> size = 0
--> stream_id = 3
t=33368 [st=1] HTTP2_SESSION_PING
--> is_ack = true
--> type = "received"
--> unique_id = 1
t=33368 [st=1] HTTP2_SESSION_RECV_HEADERS
--> fin = false
--> :status: 200
server: nginx/1.17.1
date: Mon, 28 Oct 2019 12:53:50 GMT
content-type: text/css
content-length: 18
last-modified: Mon, 28 Oct 2019 12:18:01 GMT
etag: "5db6dc79-12"
accept-ranges: bytes
--> stream_id = 4
t=33368 [st=1] HTTP2_SESSION_RECV_DATA
--> fin = false
--> size = 18
--> stream_id = 4
t=33368 [st=1] HTTP2_SESSION_UPDATE_RECV_WINDOW
--> delta = -18
--> window_size = 15727990
t=33368 [st=1] HTTP2_SESSION_UPDATE_RECV_WINDOW
--> delta = 18
--> window_size = 15728008
t=33368 [st=1] HTTP2_SESSION_RECV_DATA
--> fin = true
--> size = 0
--> stream_id = 4
t=33368 [st=1] HTTP2_SESSION_UPDATE_RECV_WINDOW
--> delta = 614
--> window_size = 15728622
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论