ninenines / cowlib

Support library for manipulating Web protocols.
ISC License
279 stars 173 forks source link

cow_hpack:table_insert may have the state with dyn_table contains entry that is larger than the max_size #103

Closed blaxmirror closed 3 years ago

blaxmirror commented 4 years ago

According to RFC7541 4.4:

If the size of the new entry is less than or equal to the maximum size, that entry is added to the table. It is not an error to attempt to add an entry that is larger than the maximum size; an attempt to add an entry larger than the maximum size causes the table to be emptied of all existing entries and results in an empty table.

If the EntrySize itself larger than the max_size in state, the cow_hpack:table_insert/2 will still return a state with this entry in the dyn_table, it should return the state with empty dyn_table if the EntrySize > MaxSize.

essen commented 3 years ago

I've merged the PR and it will be pushed soon. A new Cowlib release is planned as part of upcoming Gun 2.0. Thanks!