Class: Async::HTTP::Protocol::HTTP10
- Defined in:
- lib/async/http/protocol/http10.rb
Overview
Implements basic HTTP/1.1 request/response.
Constant Summary collapse
- KEEP_ALIVE =
'keep-alive'.freeze
- VERSION =
"HTTP/1.0".freeze
Constants inherited from HTTP11
Async::HTTP::Protocol::HTTP11::CLOSE, Async::HTTP::Protocol::HTTP11::CONNECTION, Async::HTTP::Protocol::HTTP11::CRLF, Async::HTTP::Protocol::HTTP11::HOST
Instance Attribute Summary
Attributes inherited from HTTP11
Instance Method Summary collapse
- #persistent?(headers) ⇒ Boolean
- #version ⇒ Object
- #write_body(body, chunked = false) ⇒ Object
- #write_persistent_header ⇒ Object
Methods inherited from HTTP11
#call, #good?, #hijack, #initialize, #multiplex, #next_request, #peer, #read_request, #read_response, #receive_requests, #reusable?, #write_request, #write_response
Constructor Details
This class inherits a constructor from Async::HTTP::Protocol::HTTP11
Instance Method Details
#persistent?(headers) ⇒ Boolean
36 37 38 39 40 41 42 |
# File 'lib/async/http/protocol/http10.rb', line 36 def persistent?(headers) if connection = headers[CONNECTION] return connection.include?(KEEP_ALIVE) else return false end end |
#version ⇒ Object
32 33 34 |
# File 'lib/async/http/protocol/http10.rb', line 32 def version VERSION end |
#write_body(body, chunked = false) ⇒ Object
48 49 50 51 |
# File 'lib/async/http/protocol/http10.rb', line 48 def write_body(body, chunked = false) # We don't support chunked encoding. super(body, chunked) end |
#write_persistent_header ⇒ Object
44 45 46 |
# File 'lib/async/http/protocol/http10.rb', line 44 def write_persistent_header @stream.write("connection: keep-alive\r\n") if @persistent end |