Use force_resolve for search suggestions

This commit is contained in:
Omar Roth 2019-11-07 12:25:34 -05:00
parent e56129111a
commit 142d974641
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

View File

@ -1618,7 +1618,7 @@ struct HTTPPool
response response
rescue ex rescue ex
conn = HTTPClient.new(url) conn = HTTPClient.new(url)
conn.family = (url.host == "www.youtube.com") ? CONFIG.force_resolve : Socket::Family::UNSPEC conn.family = (url.host == "www.youtube.com" || url.host == "suggestqueries.google.com") ? CONFIG.force_resolve : Socket::Family::UNSPEC
conn.read_timeout = 10.seconds conn.read_timeout = 10.seconds
conn.connect_timeout = 10.seconds conn.connect_timeout = 10.seconds
yield conn yield conn
@ -1630,7 +1630,7 @@ struct HTTPPool
private def build_pool private def build_pool
ConnectionPool(HTTPClient).new(capacity: capacity, timeout: timeout) do ConnectionPool(HTTPClient).new(capacity: capacity, timeout: timeout) do
client = HTTPClient.new(url) client = HTTPClient.new(url)
client.family = (url.host == "www.youtube.com") ? CONFIG.force_resolve : Socket::Family::UNSPEC client.family = (url.host == "www.youtube.com" || url.host == "suggestqueries.google.com") ? CONFIG.force_resolve : Socket::Family::UNSPEC
client.read_timeout = 10.seconds client.read_timeout = 10.seconds
client.connect_timeout = 10.seconds client.connect_timeout = 10.seconds
client client