You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP2 sends spurious PRIORITY packet on duplicated handles #4303
I spent a few hours working through this before discovering the unexpected PRIORITY message. Once I had tracked this down, I pared back why it was occurring and discovered that in http2.c inside h2_session_send() where the new weight and/or dependency detection logic exists, the value of data->state.stream_weight was zero whereas the value of data->set.stream_weight was 16 (which I determined was the default weight from nghttp2).
Tracking through the places where state.stream_weight is set, only Curl_http2_init_state() and the duphandle() called by push_promise() look useful. (Both in http2.c)
Possible ameliorations
One approach is simply in h2_session_send() after the call to h2_pri_spec() to only queue the PRIORITY packet if stream_id is not -1. Using a patch to this effect, I was able to fetch twitter.com usefully in my program.
Another approach, and perhaps the preferable one, would be to find the right place for Curl_http2_init_state() to be called during the point at which the HTTP connection is upgraded to HTTP2. Perhaps during Curl_http2_setup_conn() ?
I am not well-enough versed in the core of the library to make the right call here, but certainly sending a PRIORITY message to stream -1 seems very broken to me, and also to twitter.com's web server 😁
Irritatingly Twitter have made themselves less succeptible to this, so I can't directly test the fix in #4442 -- however if cURL has assert() type stuff in it, then you could simply ensure you never send PRIORITY messages to channel -1. By inspection, I think the change you made should be good enough though.
Activity
kinnison commentedon Sep 27, 2019
It looks like twitter.com is no longer failing when this spurious message is sent, but there's still an argument that it shouldn't be sent.
http2: move state-init from creation to pre-transfer
bagder commentedon Sep 30, 2019
Thanks for this report and sorry for being slow on the ball. Can you please try out the patch in #4442 and see if that fixes the problem for you?
kinnison commentedon Oct 2, 2019
Irritatingly Twitter have made themselves less succeptible to this, so I can't directly test the fix in #4442 -- however if cURL has
assert()type stuff in it, then you could simply ensure you never send PRIORITY messages to channel -1. By inspection, I think the change you made should be good enough though.bagder commentedon Oct 3, 2019
Cool, thanks. I'll add an assert to the fix as you suggest and merge.
http2: move state-init from creation to pre-transfer