Skip to content

Consider having received headers be bytes, not unicode strings. #154

Closed

Description

@Lukasa

Currently the RequestReceived, ResponseReceived, and TrailersReceived events all return the headers as a list of tuples of unicode strings. This happens because HPACK decodes the headers as UTF-8 before use. While this is enormously convenient when it works, which is almost all the time, it introduces the risk that a senseless HTTP/2 implementation may send non-UTF-8-encoded data and have hyper-h2 barf on it.

For the 2.x series we're stuck with this design decision, but when we come to look at doing a 3.0.0 we may want to revisit this decision.

Activity

  1. added this to the 3.0.0 milestone on Feb 7, 2016
  2. Kriechi commented on Jun 30, 2016

    @Kriechi
    Member

    I think this is fully covered in #198 - and the only remaining thing to discuss/decide is to change the default encoding from utf-8 to no encoding in a 3.0 release.

    Personally I have no strong opinion, since changing it is a simple flag on the connection. However I'm slightly leaning toward going raw bytes-only for all internals, just so API users need to think about what they expect to get and what they actually want.

  3. Lukasa commented on Jul 1, 2016

    @Lukasa
    MemberAuthor

    Agreed, this issue is basically whether or not we change the default. I remain +1 on changing the default: I think unicode-by-default was the wrong choice, though it seemed sensible back when I first made that call in 2014.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions