hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.35k stars 270 forks source link

Support very large headers #555

Closed nox closed 3 years ago

nox commented 3 years ago

This completely refactors how headers are hpack-encoded.

Instead of trying to be clever, constructing frames on the go while hpack-encoding, we just make a blob of all the hpack-encoded headers first, and then we split that blob in as many frames as necessary.

ipostelnik commented 3 years ago

Where does it check that total header size doesn't exceed SETTINGS_MAX_HEADER_LIST_SIZE?

nox commented 3 years ago

Pretty sure it doesn't check that when encoding, note that it didn't beforehand either.

LPardue commented 3 years ago

There's a risk with enforcing SETTINGS_MAX_HEADER_LIST_SIZE when sending. The input may come from some other component or system that doesn't have such limits, and/or may not be able to change they header list to fit that size. An H2 library that enforces the rule can cause problems, so if it's ever implemented it probably needs to be optional.

nox commented 3 years ago

This looks nice and clean to me! Perhaps a test in h2-tests/codec_write about sending a header that would have been too big before?

I added a 32KiB header in the existing test.