class Tipi::DefaultHandler
Constants
- ALPN_PROTOCOLS
- H2_PROTOCOL
Public Class Methods
new(config)
click to toggle source
# File lib/tipi/handler.rb, line 9 def initialize(config) @config = config app_path = ARGV.first || './config.ru' @app = Tipi::RackAdapter.load(app_path) end
Public Instance Methods
call(socket)
click to toggle source
# File lib/tipi/handler.rb, line 16 def call(socket) socket.no_delay if socket.respond_to?(:no_delay) adapter = protocol_adapter(socket, {}) adapter.each(&@app) ensure socket.close end
protocol_adapter(socket, opts)
click to toggle source
# File lib/tipi/handler.rb, line 27 def protocol_adapter(socket, opts) use_http2 = socket.respond_to?(:alpn_protocol) && socket.alpn_protocol == H2_PROTOCOL klass = use_http2 ? HTTP2Adapter : HTTP1Adapter klass.new(socket, opts) end