-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
The HPackEncoder has a potential infinite loop today.
https://github.com/aspnet/KestrelHttpServer/blob/55e5e564226e7b27742c91f46ea71841071e4ac3/src/Kestrel.Core/Internal/Http2/HPack/HPackEncoder.cs#L35-L42
EncodeHeader returns false if it does not have enough space to encode the value. If this header was larger than max frame size then no data will be available for the frame at all and length will be 0. The server will be stuck in an infinite loop sending zero length continuation frames.
aspnet/KestrelHttpServer#2893 added an exception to break the infinate loop, but it did so by throwing and very ungracefully aborting the socket.
Proposal: The spec allows splitting encoded headers across frames. This would allow the encoder to pack frames more densely and always make progress.
Priority: Not urgent, the response header would need to be larger than the max frame size (16kb). The client and server can also raise that frame size. Implementing real response header compression would allow even larger values before hitting the frame size limit.