Returns the port number
of this request as an integer.
class Request<Rack::RequestincludeActionDispatch::Http::URLendreq=Request.new'HTTP_HOST'=>'example.com'req.port# => 80req=Request.new'HTTP_HOST'=>'example.com:8080'req.port# => 8080
# File actionpack/lib/action_dispatch/http/url.rb, line 278
def port
@port ||= begin
if raw_host_with_port =~ /:(\d+)$/
$1.to_i
else
standard_port
end
end
end