Skip to content

Allow users to obtain raw headers. - #198

Merged
Lukasa merged 6 commits into
masterfrom
raw-headers
Apr 14, 2016
Merged

Lukasa merged 6 commits into
masterfrom
raw-headers

Conversation

@Lukasa

@Lukasa Lukasa commented Apr 13, 2016

Copy link
Copy Markdown
Member

This change adds a new flag that allows users to request 'raw' headers: that is, headers that have not been decoded to unicode and are still in bytes form. This was originally requested by the Twisted developers who use a bytes internal headers representation, though it may well be useful for others.

This change involves quite a substantial internal change: we now have headers move through the body of hyper-h2 in bytes form, and only get encoded at the edge.

This change introduces one unfortunate problem: we need to bump the minimum version of HPACK we can use. I believe this is safe to do in a semver-minor release, as we're only bumping the minor version, so the upgrade should be safe.

The default output for headers remains unicode. That may change in 3.0.0 (per #154), but for now we're leaving it as-is.

Lukasa added 6 commits April 13, 2016 14:44
We need this for the raw kwarg.
This changes our internal representation of headers to use bytes
everywhere, rather than unicode.

hyper-h2 actually previously played a bit fast-and-loose with header
format internally, meaning that on Python 2 there was quite a bit of
implicit encoding/decoding going on when we worked with headers. This
should remove that: headers are bytes up until right when we're done
with them, at which point they *may* become unicode.

Note that becoming unicode is now optional.
@Lukasa

Lukasa commented Apr 13, 2016

Copy link
Copy Markdown
Member Author

/cc @mhils @hawkowl as this is relevant to both your interests.

@hawkowl

hawkowl commented Apr 13, 2016

Copy link
Copy Markdown
Member

This looks pretty good to me 👍

@mhils

mhils commented Apr 13, 2016

Copy link
Copy Markdown
Member

Our netlib.http.Headers class works on bytes as well, so this change is a very welcome addition. 😃

Looks good to me as well! 👍

@Lukasa

Lukasa commented Apr 14, 2016

Copy link
Copy Markdown
Member Author

Ok, I'm going to land this now.

@Lukasa
Lukasa merged commit 9504e87 into master Apr 14, 2016
@Lukasa
Lukasa deleted the raw-headers branch April 14, 2016 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants