apple / swift-nio-http2

HTTP/2 support for SwiftNIO
https://swiftpackageindex.com/apple/swift-nio-http2/main/documentation/niohttp2
Apache License 2.0
462 stars 82 forks source link

Discard read bytes when accumulating continuation frames #444

Closed glbrntt closed 2 months ago

glbrntt commented 2 months ago

Motivation:

When accumulating sequences of CONTINUATION frames, each frame is parsed from a buffer. These bytes are read when the CONTINUATION frame is parsed, but if more CONTINUATION frames follow then the buffer isn't reset. This means that long sequences of CONTINUATION frames can result in a larger than necessary buffer where most of the contents have already been read.

Modifications:

Result:

Lower memory footprint when parsing sequences of CONTINUATION frames.