Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use URI.parser method, and remove 1.8.x code #4521

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion actionpack/lib/action_dispatch/routing/redirection.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'action_dispatch/http/request'
require 'active_support/core_ext/uri'

module ActionDispatch
module Routing
Expand All @@ -13,7 +14,7 @@ def initialize(status, block)
def call(env)
req = Request.new(env)

uri = URI.parse(path(req.symbolized_path_parameters, req))
uri = URI.parser.parse(path(req.symbolized_path_parameters, req))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this stay as URI.parse?

uri.scheme ||= req.scheme
uri.host ||= req.host
uri.port ||= req.port unless req.standard_port?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'active_support/core_ext/uri'

module ActiveRecord
module ConnectionAdapters
class ConnectionSpecification #:nodoc:
Expand Down Expand Up @@ -61,7 +63,7 @@ def resolve_hash_connection(spec) # :nodoc:
end

def connection_url_to_hash(url) # :nodoc:
config = URI.parse url
config = URI.parser.parse url
adapter = config.scheme
adapter = "postgresql" if adapter == "postgres"
spec = { :adapter => adapter,
Expand Down
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/core_ext/uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def unescape(str, escaped = /%[a-fA-F\d]{2}/)
module URI
class << self
def parser
@parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
@parser ||= URI::Parser.new
end
end
end