python-hyper / hpack

HTTP/2 Header Encoding for Python
https://hpack.readthedocs.io/en/latest/
MIT License
72 stars 32 forks source link

hpack - disable dynamic table #271

Closed lemur117 closed 1 year ago

lemur117 commented 2 years ago

How can I disable the HTTP/2 dynamic table? I would like to prevent to caching of headers so that the full header content has to be sent on the wire each time, not just the index to the dynamic table. I've tried playing with the "self.max_allowed_table_size" value, but I haven't gotten it to work.

Kriechi commented 2 years ago

You probably have to communicate that with the actual protocol HTTP/2 outside of hpack - see https://datatracker.ietf.org/doc/html/rfc7541#section-4.2 with a section at the end on how to "clear" the dynamic table.

lemur117 commented 2 years ago

Thanks for the pointer. Do you know where I should look to communicate with the HTTP/2 protocol? And how that could be exposed when I'm creating an HTTP20Connection object?

E.g., what I'm trying to do is:

from hyper import HTTP20Connection
connection = HTTP20Connection(f'{ip_port}')

Then I want to either disable the dynamic table completely or be able clear it on demand. I was hoping hpack was the right place to look, but if not, would it still be within the hyper collection?

Kriechi commented 2 years ago

Sorry, the hyper library has been unsupported for years.

The h2 library is using hpack - but you would need to update/upgrade to h2.

Or are you using any other connection library or wrapper?