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

- old
+ new

@@ -45,14 +45,13 @@ # # @option options [Integer] :Port # The port to listen on. # def initialize(app,options={}) - @app = app + @app = app @options = options - - @server = nil + @server = nil end # # Creates a new handler and begins handling HTTP Requests. # @@ -65,12 +64,12 @@ # # Starts {Net::HTTP::Server} and begins handling HTTP Requests. # def run @server = Net::HTTP::Server::Daemon.new( - :host => @options[:Host], - :port => @options[:Port], + :host => @options[:Host], + :port => @options[:Port], :handler => self ) @server.start @server.join @@ -87,13 +86,13 @@ # # @return [Array<Integer, Hash, Array>] # The response status, headers and body. # def call(request,stream) - request_uri = request[:uri] + request_uri = request[:uri] remote_address = stream.socket.remote_address - local_address = stream.socket.local_address + local_address = stream.socket.local_address env = {} # add the default values env.merge!(DEFAULT_ENV) @@ -103,19 +102,19 @@ if request_uri[:scheme] env['rack.url_scheme'] = request_uri[:scheme].to_s end - env['SERVER_NAME'] = local_address.getnameinfo[0] - env['SERVER_PORT'] = local_address.ip_port.to_s + env['SERVER_NAME'] = local_address.getnameinfo[0] + env['SERVER_PORT'] = local_address.ip_port.to_s env['SERVER_PROTOCOL'] = "HTTP/#{request[:http_version]}" 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['PATH_INFO'] = request_uri.fetch(:path,'*').to_s + env['QUERY_STRING'] = request_uri[:query_string].to_s # add the headers request[:headers].each do |name,value| key = name.dup