Class: HTTPX::Parser::HTTP1
- Inherits:
-
Object
- Object
- HTTPX::Parser::HTTP1
- Defined in:
- lib/httpx/parser/http1.rb
Constant Summary collapse
- VERSIONS =
%w[1.0 1.1].freeze
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http_version ⇒ Object
readonly
Returns the value of attribute http_version.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #<<(chunk) ⇒ Object
-
#initialize(observer, header_separator: ":") ⇒ HTTP1
constructor
A new instance of HTTP1.
- #reset! ⇒ Object
- #upgrade? ⇒ Boolean
- #upgrade_data ⇒ Object
Constructor Details
#initialize(observer, header_separator: ":") ⇒ HTTP1
Returns a new instance of HTTP1.
12 13 14 15 16 17 18 |
# File 'lib/httpx/parser/http1.rb', line 12 def initialize(observer, header_separator: ":") @observer = observer @state = :idle @header_separator = header_separator @buffer = "".b @headers = {} end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
10 11 12 |
# File 'lib/httpx/parser/http1.rb', line 10 def headers @headers end |
#http_version ⇒ Object (readonly)
Returns the value of attribute http_version.
10 11 12 |
# File 'lib/httpx/parser/http1.rb', line 10 def http_version @http_version end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
10 11 12 |
# File 'lib/httpx/parser/http1.rb', line 10 def status_code @status_code end |
Instance Method Details
#<<(chunk) ⇒ Object
20 21 22 23 |
# File 'lib/httpx/parser/http1.rb', line 20 def <<(chunk) @buffer << chunk parse end |
#reset! ⇒ Object
25 26 27 28 29 30 |
# File 'lib/httpx/parser/http1.rb', line 25 def reset! @state = :idle @headers.clear @content_length = nil @_has_trailers = nil end |
#upgrade? ⇒ Boolean
32 33 34 |
# File 'lib/httpx/parser/http1.rb', line 32 def upgrade? @upgrade end |
#upgrade_data ⇒ Object
36 37 38 |
# File 'lib/httpx/parser/http1.rb', line 36 def upgrade_data @buffer end |