Class: Async::HTTP::Protocol::HTTP1
- Inherits:
-
IO::Protocol::Line
- Object
- IO::Protocol::Line
- Async::HTTP::Protocol::HTTP1
- Defined in:
- lib/async/http/protocol/http1.rb
Overview
A server that supports both HTTP1.0 and HTTP1.1 semantics by detecting the version of the request.
Constant Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #create_handler(version) ⇒ Object
-
#initialize(stream) ⇒ HTTP1
constructor
A new instance of HTTP1.
- #receive_requests(&block) ⇒ Object
Constructor Details
Class Method Details
Instance Method Details
#create_handler(version) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/async/http/protocol/http1.rb', line 48 def create_handler(version) if klass = HANDLERS[version] klass.server(@stream) else raise RuntimeError, "Unsupported protocol version #{version}" end end |
#receive_requests(&block) ⇒ Object
56 57 58 59 60 |
# File 'lib/async/http/protocol/http1.rb', line 56 def receive_requests(&block) method, path, version = self.peek_line.split(/\s+/, 3) create_handler(version).receive_requests(&block) end |