Merge branch 'issue-184' into 'master'

bugfix: bust cache lookup if returned set from different ip family

Closes #184

See merge request honeyryderchuck/httpx!195
This commit is contained in:
HoneyryderChuck 2022-02-20 23:01:27 +00:00
commit eeeac1f785
2 changed files with 26 additions and 0 deletions

View File

@ -74,6 +74,8 @@ module HTTPX
addresses.select! { |addr| addr.family == @family }
return if addresses.empty?
emit_addresses(connection, @family, addresses)
end

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
require "test_helper"
require "support/http_helpers"
require "support/minitest_extensions"
class Bug_0_19_3_Test < Minitest::Test
include HTTPHelpers
def test_dns_lookup_cache_for_domains_with_same_cname
HTTPX.plugin(SessionWithPool).wrap do |http|
_response1 = http.get("https://accounts.vivapayments.com")
_response2 = http.get("https://api.vivapayments.com")
assert http.pool.connection_count == 2
conn1, conn2 = http.pool.connections
assert conn1.origin != conn2.origin
assert conn1.addresses.sort == conn2.addresses.sort
end
end
end