class HTTPX::Parser::HTTP1

  1. lib/httpx/parser/http1.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. <<
  2. headers
  3. http_version
  4. reset!
  5. status_code
  6. upgrade?
  7. upgrade_data

Constants

VERSIONS = %w[1.0 1.1].freeze  

Attributes

Public Class methods

new (observer, header_separator: ":")
[show source]
   # File lib/httpx/parser/http1.rb
12 def initialize(observer, header_separator: ":")
13   @observer = observer
14   @state = :idle
15   @header_separator = header_separator
16   @buffer = "".b
17   @headers = {}
18 end

Public Instance methods

<< (chunk)
[show source]
   # File lib/httpx/parser/http1.rb
20 def <<(chunk)
21   @buffer << chunk
22   parse
23 end
reset! ()
[show source]
   # File lib/httpx/parser/http1.rb
25 def reset!
26   @state = :idle
27   @headers.clear
28   @content_length = nil
29   @_has_trailers = nil
30 end
upgrade? ()
[show source]
   # File lib/httpx/parser/http1.rb
32 def upgrade?
33   @upgrade
34 end
upgrade_data ()
[show source]
   # File lib/httpx/parser/http1.rb
36 def upgrade_data
37   @buffer
38 end