-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: No more BytesWarnings #1286
base: master
Are you sure you want to change the base?
Conversation
Fixed format-related things mostly. I think we should still do a full repo |
Fixes python-hyper#1236. This patch makes all header operations operate on `bytes` and converts all headers and values to bytes before operation. With a follow up patch to `hpack` it should also increase efficiency as currently, `hpack` casts everything to a `str` first before converting back to bytes: https://github.com/python-hyper/hpack/blob/02afcab28ca56eb5259904fd414baa89e9f50266/src/hpack/hpack.py#L150-L151
c95e738
to
605f0ea
Compare
Please keep the changes in each PR to a minimum - in this case please revert the style-related changes. |
@Kriechi we should be good now, sorry for the trouble. |
norm_headers = h2.utilities.normalize_outbound_headers(headers, None, False) | ||
norm_headers = h2.utilities.normalize_outbound_headers( | ||
h2.utilities.utf8_encode_headers(headers), None, False | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm contemplating making the encoding of headers part of the normalization pipeline, instead of being the responsibility of the outside caller.
What do you think about integrating it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly what I wanted but unfortunately we have an option to bypass normalization, which breaks that neat abstraction :(
Fixes #1236.
This patch makes all header operations operate on
bytes
and converts all headers and values to bytes before operation. With a follow up patch tohpack
it should also increase efficiency as currently,hpack
casts everything to astr
first before converting back to bytes: https://github.com/python-hyper/hpack/blob/02afcab28ca56eb5259904fd414baa89e9f50266/src/hpack/hpack.py#L150-L151