Method: Net::HTTP::Server::Requests#normalize_uri

Defined in:
lib/net/http/server/requests.rb

#normalize_uri(request) ⇒ Object (protected)

Normalizes the :uri part of the request.

Parameters:

  • request (Hash)

    The unnormalized HTTP request.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/net/http/server/requests.rb', line 65

def normalize_uri(request)
  uri = request[:uri]

  case uri
  when Hash
    if uri[:scheme]
      uri[:port] = unless uri[:port]
                     DEFAULT_PORTS[uri[:scheme]]
                   else
                     uri[:port].to_i
                   end
    end
  when '*'
    request[:uri] = {}
  end
end