mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
disabling IDN support for ruby < 2.3
This commit is contained in:
parent
1b26977d16
commit
86f1db5bf0
@ -17,18 +17,25 @@ module HTTPX
|
||||
time - Time.now
|
||||
end
|
||||
|
||||
def uri(uri)
|
||||
return Kernel.URI(uri) unless uri.is_a?(String) && !uri.ascii_only?
|
||||
if RUBY_VERSION < "2.3"
|
||||
def uri(*args)
|
||||
URI(*args)
|
||||
end
|
||||
else
|
||||
|
||||
uri = Kernel.URI(URI.escape(uri))
|
||||
def uri(uri)
|
||||
return Kernel.URI(uri) unless uri.is_a?(String) && !uri.ascii_only?
|
||||
|
||||
non_ascii_hostname = URI.unescape(uri.host)
|
||||
uri = Kernel.URI(URI.escape(uri))
|
||||
|
||||
idna_hostname = DomainName.new(non_ascii_hostname).hostname
|
||||
non_ascii_hostname = URI.unescape(uri.host)
|
||||
|
||||
uri.host = idna_hostname
|
||||
uri.non_ascii_hostname = non_ascii_hostname
|
||||
uri
|
||||
idna_hostname = DomainName.new(non_ascii_hostname).hostname
|
||||
|
||||
uri.host = idna_hostname
|
||||
uri.non_ascii_hostname = non_ascii_hostname
|
||||
uri
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -82,6 +82,6 @@ module Requests
|
||||
|
||||
response = HTTPX.get(build_uri("/get?q=ã"))
|
||||
verify_status(response, 200)
|
||||
end
|
||||
end unless RUBY_VERSION < "2.3"
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user