lib/rack/handler/http.rb in net-http-server-0.2.2 vs lib/rack/handler/http.rb in net-http-server-0.2.3

- old
+ new

@@ -35,42 +35,42 @@ # Initializes the handler. # # @param [#call] app # The application the handler will be passing requests to. # - # @param [Hash] options + # @param [Hash{Symbol => Object}] options # Additional options. # # @option options [String] :Host # The host to bind to. # # @option options [Integer] :Port # The port to listen on. # - def initialize(app,options={}) + def initialize(app,**options) @app = app @options = options @server = nil end # # Creates a new handler and begins handling HTTP Requests. # # @see #initialize # - def self.run(app,options={}) - new(app,options).run + def self.run(app,**options) + new(app,**options).run end # # Starts {Net::HTTP::Server} and begins handling HTTP Requests. # def run @server = Net::HTTP::Server::Daemon.new( - :host => @options[:Host], - :port => @options[:Port], - :handler => self + host: @options[:Host], + port: @options[:Port], + handler: self ) @server.start @server.join end @@ -111,15 +111,15 @@ env['REMOTE_ADDR'] = remote_address.ip_address env['REMOTE_PORT'] = remote_address.ip_port.to_s env['REQUEST_METHOD'] = request[:method].to_s env['PATH_INFO'] = request_uri.fetch(:path,'*').to_s - env['QUERY_STRING'] = request_uri[:query_string].to_s + env['QUERY_STRING'] = request_uri[:query].to_s # add the headers request[:headers].each do |name,value| key = name.dup - + key.upcase! key.tr!('-','_') # if the header is not special, prepend 'HTTP_' unless SPECIAL_HEADERS.include?(name)