mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -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.
|
||||
# The result will be a downcased, ASCII-only string.
|
||||
def normalize(domain)
|
||||
domain = domain.chomp(".").unicode_normalize(:nfc) unless domain.ascii_only?
|
||||
Punycode.encode_hostname(domain).downcase
|
||||
unless domain.ascii_only?
|
||||
domain = domain.chomp(".").unicode_normalize(:nfc)
|
||||
domain = Punycode.encode_hostname(domain)
|
||||
end
|
||||
|
||||
domain.downcase
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user