encode/httpx#1214 prefer sending outbound cookies separately to improve headers compression#1275
Conversation
| if isinstance(header, HeaderTuple): | ||
| yield header.__class__(header[0], cookie_val) | ||
| else: | ||
| yield header[0], cookie_val |
There was a problem hiding this comment.
At this point, what are the trade-offs to simply always create HeaderTuple's?
There was a problem hiding this comment.
Since we use the same approach in
Lines 549 to 552 in c7f967d
There was a problem hiding this comment.
|
Question for some context: if a client sends Cookie headers that are already split does h2 combine them somewhere or will the split header fields be encoded as expected? |
|
@sethmlarson I asked myself the same thing, and found this: Lines 583 to 603 in c7f967d |
|
as a first step to a review, I fixed our project CI (which was a challenge by itself). I don't see any obvious issues with the code itself - though I still need time to think and read through the spec and implications. Happy to hear other thoughts in the mean time! @cdeler you said:
I don't see an "option" in your PR - its "always on"? |
48f26a2 to
65b719c
Compare
…to improve headers compression
65b719c to
a48a2fe
Compare
|
Hello @Kriechi
I don't think so (because RFC says "may") :-) , so that I updated the PR adding |
|
LGTM! |
|
Hello, |
According to the rfc7540#section-8.1.2.5,
The
h2framework is used by thehttpxclient, and some users require to have an ability to send cookies via separate headers to follow http2 practice. Or at least to make this option configurable (more: encode/httpx#1214).As
h2decides how to properly send data over the transport,h2seems to be a right place to add an ability to split the cookie headers. Also the opposite functionality is added to the inbound cookies processing (ref).Notes:
I have concerns about my PR, may be you can help me with suggestings: