Class: Async::HTTP::Protocol::HTTP1::Connection
- Inherits:
-
HTTP::Protocol::HTTP1::Connection
- Object
- HTTP::Protocol::HTTP1::Connection
- Async::HTTP::Protocol::HTTP1::Connection
- Defined in:
- lib/async/http/protocol/http1/connection.rb
Constant Summary collapse
- CRLF =
"\r\n"
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #close ⇒ Object
-
#connected? ⇒ Boolean
Can we use this connection to make requests?.
-
#hijack ⇒ Async::Wrapper
The underlying non-blocking IO.
- #multiplex ⇒ Object
- #peer ⇒ Object
- #read_chunked_body ⇒ Object
- #read_fixed_body(length) ⇒ Object
- #read_line ⇒ Object
- #read_remainder_body ⇒ Object
- #read_tunnel_body ⇒ Object
- #reusable? ⇒ Boolean
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
55 56 57 |
# File 'lib/async/http/protocol/http1/connection.rb', line 55 def count @count end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
36 37 38 |
# File 'lib/async/http/protocol/http1/connection.rb', line 36 def stream @stream end |
Instance Method Details
#close ⇒ Object
71 72 73 74 75 |
# File 'lib/async/http/protocol/http1/connection.rb', line 71 def close Async.logger.debug(self) {"Closing connection"} @stream.close end |
#connected? ⇒ Boolean
Can we use this connection to make requests?
62 63 64 |
# File 'lib/async/http/protocol/http1/connection.rb', line 62 def connected? @stream.connected? end |
#hijack ⇒ Async::Wrapper
Returns the underlying non-blocking IO.
43 44 45 46 47 48 49 |
# File 'lib/async/http/protocol/http1/connection.rb', line 43 def hijack @persistent = false @stream.flush return @stream.io end |
#multiplex ⇒ Object
57 58 59 |
# File 'lib/async/http/protocol/http1/connection.rb', line 57 def multiplex 1 end |
#peer ⇒ Object
51 52 53 |
# File 'lib/async/http/protocol/http1/connection.rb', line 51 def peer @stream.io end |
#read_chunked_body ⇒ Object
77 78 79 |
# File 'lib/async/http/protocol/http1/connection.rb', line 77 def read_chunked_body Body::Chunked.new(self) end |
#read_fixed_body(length) ⇒ Object
81 82 83 |
# File 'lib/async/http/protocol/http1/connection.rb', line 81 def read_fixed_body(length) Body::Fixed.new(@stream, length) end |
#read_line ⇒ Object
38 39 40 |
# File 'lib/async/http/protocol/http1/connection.rb', line 38 def read_line @stream.read_until(CRLF) or raise EOFError end |
#read_remainder_body ⇒ Object
89 90 91 |
# File 'lib/async/http/protocol/http1/connection.rb', line 89 def read_remainder_body Body::Remainder.new(@stream) end |
#read_tunnel_body ⇒ Object
85 86 87 |
# File 'lib/async/http/protocol/http1/connection.rb', line 85 def read_tunnel_body read_remainder_body end |
#reusable? ⇒ Boolean
66 67 68 69 |
# File 'lib/async/http/protocol/http1/connection.rb', line 66 def reusable? !@stream.closed? # !(self.closed? || @stream.closed?) end |