igrigorik / http-2

Pure Ruby implementation of HTTP/2 protocol
https://httpwg.github.io/specs/rfc7540.html
MIT License
894 stars 63 forks source link

Decompressor comment incorrect #155

Closed sshock closed 3 months ago

sshock commented 4 years ago

In the HTTP2::Header::Decompressor class it has this comment:

    # Responsible for decoding received headers and maintaining compression
    # context of the opposing peer. Decompressor must be initialized with
    # appropriate starting context based on local role: client or server.
    #
    # @example
    #   server_role = Decompressor.new(:request)
    #   client_role = Decompressor.new(:response)

Yet the constructor does not take any normal arguments, just an options hash:

      def initialize(**options)
        @cc = EncodingContext.new(options)
      end

So if you try to initialize it as described, you'll get a wrong number of arguments error.

igrigorik commented 4 years ago

Good catch, ty for reporting it! Is this a documentation bug only, or does it affect some functionality you're looking to wire up?

sshock commented 4 years ago

As far as I know it's just a documentation bug. I've been able to decode header frames no problem, both on the client and on the server side.