mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-07 00:05:02 -04:00
Return domain name early if ASCII only
This commit is contained in:
parent
61ce888e47
commit
554b5a663c
@ -61,8 +61,12 @@ module HTTPX
|
|||||||
# Normalizes a _domain_ using the Punycode algorithm as necessary.
|
# Normalizes a _domain_ using the Punycode algorithm as necessary.
|
||||||
# The result will be a downcased, ASCII-only string.
|
# The result will be a downcased, ASCII-only string.
|
||||||
def normalize(domain)
|
def normalize(domain)
|
||||||
domain = domain.chomp(".").unicode_normalize(:nfc) unless domain.ascii_only?
|
unless domain.ascii_only?
|
||||||
Punycode.encode_hostname(domain).downcase
|
domain = domain.chomp(".").unicode_normalize(:nfc)
|
||||||
|
domain = Punycode.encode_hostname(domain)
|
||||||
|
end
|
||||||
|
|
||||||
|
domain.downcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user