ubeddulla opened a new pull request, #3542: URL: https://github.com/apache/brpc/pull/3542
### What problem does this PR solve? Issue Number: resolve N/A Problem Summary: When a HEADERS frame opens a stream past `max_concurrent_streams`, `H2Context::OnHeaders` returns `RST_STREAM(REFUSED_STREAM)` but never consumes that frame's header-block payload. REFUSED_STREAM is a stream error, so the connection stays open and `ParseH2Message` keeps parsing; the leftover header-block bytes are then read by `ConsumeFrameHead` as the next frame head, letting a peer smuggle frames past the h2 framing layer, and the HPACK decoder is left desynced because the refused block was never decoded. `OnData` and the client-side unknown-stream branch right below already drain the payload before returning a stream error; only the refused-stream path skipped it. ### What is changed and the side effects? Changed: Decode and consume the refused stream's header block (`sctx->OnHeaders`) before deleting the context and returning REFUSED_STREAM, mirroring the two sibling paths. This keeps both the frame parser and the HPACK decoder in sync. Added a regression test in `test/brpc_http_rpc_protocol_unittest.cpp` that fails before the change (only the 9-byte frame head was consumed, leaving the header block to be misparsed) and passes after. Side effects: - Performance effects: one extra HPACK decode of a header block that is then discarded, only on refused streams. - Breaking backward compatibility: none. --- ### Check List: - Please make sure your changes are compilable. - When providing us with a new feature, it is best to add related tests. - Please follow [Contributor Covenant Code of Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
