Class: Async::HTTP::Protocol::HTTP1::Connection
- Inherits:
-
Protocol::HTTP1::Connection
- Object
- Protocol::HTTP1::Connection
- Async::HTTP::Protocol::HTTP1::Connection
- Defined in:
- lib/async/http/protocol/http1/connection.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #concurrency ⇒ Object
- #http1? ⇒ Boolean
- #http2? ⇒ Boolean
-
#initialize(stream, version) ⇒ Connection
constructor
A new instance of Connection.
- #peer ⇒ Object
- #read_line ⇒ Object
- #read_line? ⇒ Boolean
- #reusable? ⇒ Boolean
-
#viable? ⇒ Boolean
Can we use this connection to make requests?.
Constructor Details
#initialize(stream, version) ⇒ Connection
Returns a new instance of Connection.
33 34 35 36 37 38 |
# File 'lib/async/http/protocol/http1/connection.rb', line 33 def initialize(stream, version) super(stream) @ready = true @version = version end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
62 63 64 |
# File 'lib/async/http/protocol/http1/connection.rb', line 62 def count @count end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
40 41 42 |
# File 'lib/async/http/protocol/http1/connection.rb', line 40 def version @version end |
Instance Method Details
#concurrency ⇒ Object
64 65 66 |
# File 'lib/async/http/protocol/http1/connection.rb', line 64 def concurrency 1 end |
#http1? ⇒ Boolean
42 43 44 |
# File 'lib/async/http/protocol/http1/connection.rb', line 42 def http1? true end |
#http2? ⇒ Boolean
46 47 48 |
# File 'lib/async/http/protocol/http1/connection.rb', line 46 def http2? false end |
#peer ⇒ Object
58 59 60 |
# File 'lib/async/http/protocol/http1/connection.rb', line 58 def peer @stream.io end |
#read_line ⇒ Object
54 55 56 |
# File 'lib/async/http/protocol/http1/connection.rb', line 54 def read_line @stream.read_until(CRLF) or raise EOFError, "Could not read line!" end |
#read_line? ⇒ Boolean
50 51 52 |
# File 'lib/async/http/protocol/http1/connection.rb', line 50 def read_line? @stream.read_until(CRLF) end |
#reusable? ⇒ Boolean
73 74 75 |
# File 'lib/async/http/protocol/http1/connection.rb', line 73 def reusable? @ready && @persistent && @stream && !@stream.closed? end |
#viable? ⇒ Boolean
Can we use this connection to make requests?
69 70 71 |
# File 'lib/async/http/protocol/http1/connection.rb', line 69 def viable? @ready && @stream&.connected? end |