1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

ws-over-h2: wrong sid on rst_stream

rst_stream is almost always called from the h2 parser... in the case
a ws-over-h2 is closing though, it can't reference the h2n parser sid
context to get the sid to send... it's unrelated at that time.

https://bugzilla.mozilla.org/show_bug.cgi?id=1590299
https://github.com/warmcat/libwebsockets/issues/1752
This commit is contained in:
Andy Green 2019-11-04 21:19:53 +00:00
parent d3cda2b1d7
commit 6786ce9e33

View file

@ -400,17 +400,19 @@ lws_h2_rst_stream(struct lws *wsi, uint32_t err, const char *reason)
if (!h2n)
return 0;
if (h2n->type == LWS_H2_FRAME_TYPE_COUNT)
if (!wsi->h2_stream_carries_ws && h2n->type == LWS_H2_FRAME_TYPE_COUNT)
return 0;
pps = lws_h2_new_pps(LWS_H2_PPS_RST_STREAM);
if (!pps)
return 1;
lwsl_info("%s: RST_STREAM 0x%x, REASON '%s'\n", __func__, err, reason);
lwsl_info("%s: RST_STREAM 0x%x, sid %d, REASON '%s'\n", __func__, err,
wsi->h2.my_sid, reason);
pps->u.rs.sid = h2n->sid;
pps->u.rs.sid = wsi->h2.my_sid;
pps->u.rs.err = err;
lws_pps_schedule(wsi, pps);
h2n->type = LWS_H2_FRAME_TYPE_COUNT; /* ie, IGNORE */