mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-07-14 00:00:49 -04:00
Compare commits
8 Commits
5448037912
...
c99194e298
Author | SHA1 | Date | |
---|---|---|---|
|
c99194e298 | ||
|
6881dd2bc4 | ||
|
7604d9deb9 | ||
|
d7431e76a2 | ||
|
efaa0e8066 | ||
|
d0fcd13bf2 | ||
|
0a35b125f4 | ||
|
a6cfaf4ec3 |
@ -30,7 +30,7 @@ variables:
|
||||
.yjit_matrix: &yjit_matrix
|
||||
parallel:
|
||||
matrix:
|
||||
- RUBYOPT: ["", "--jit --jit-warnings --jit-wait", "--yjit"]
|
||||
- RUBYOPT: ["", "--yjit"]
|
||||
|
||||
# Cache gems in between builds
|
||||
cache:
|
||||
@ -81,11 +81,14 @@ test ruby 2/7:
|
||||
./spec.sh ruby 2.7
|
||||
test ruby 3/0:
|
||||
<<: *test_settings
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
./spec.sh ruby 3.0
|
||||
test ruby 3/1:
|
||||
<<: *test_settings
|
||||
<<: *yjit_matrix
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
./spec.sh ruby 3.1
|
||||
test ruby 3/2:
|
||||
@ -98,6 +101,21 @@ test truffleruby:
|
||||
script:
|
||||
./spec.sh truffleruby latest
|
||||
allow_failure: true
|
||||
regression tests:
|
||||
image: "ruby:3.2"
|
||||
variables:
|
||||
BUNDLE_WITHOUT: assorted
|
||||
CI: 1
|
||||
COVERAGE_KEY: "$RUBY_ENGINE-$RUBY_VERSION-regression-tests"
|
||||
artifacts:
|
||||
paths:
|
||||
- coverage/
|
||||
stage: test
|
||||
before_script:
|
||||
- apt-get update && apt-get install -y libmagic-dev shared-mime-info
|
||||
- bundle install
|
||||
script:
|
||||
- bundle exec rake regression_tests
|
||||
|
||||
coverage:
|
||||
coverage: '/\(\d+.\d+\%\) covered/'
|
||||
|
@ -557,7 +557,7 @@ module HTTPX
|
||||
return if @state == :closed
|
||||
|
||||
@io.connect
|
||||
emit(:tcp_open) if @io.state == :connected
|
||||
emit(:tcp_open, self) if @io.state == :connected
|
||||
|
||||
return unless @io.connected?
|
||||
|
||||
|
@ -15,7 +15,7 @@ module HTTPX
|
||||
# https://github.com/ruby/resolv/blob/095f1c003f6073730500f02acbdbc55f83d70987/lib/resolv.rb#L408
|
||||
ip_address_families = begin
|
||||
list = Socket.ip_address_list
|
||||
if list.any? { |a| a.ipv6? && !a.ipv6_loopback? && !a.ipv6_linklocal? }
|
||||
if list.any? { |a| a.ipv6? && !a.ipv6_loopback? && !a.ipv6_linklocal? && !a.ipv6_unique_local? }
|
||||
[Socket::AF_INET6, Socket::AF_INET]
|
||||
else
|
||||
[Socket::AF_INET]
|
||||
|
@ -137,7 +137,7 @@ module HTTPX
|
||||
new_connection = connection.class.new(connection.type, connection.origin, connection.options)
|
||||
new_connection.family = family
|
||||
|
||||
connection.once(:tcp_open, &new_connection.method(:force_reset))
|
||||
connection.once(:tcp_open) { new_connection.force_reset }
|
||||
connection.once(:connect_error) do |err|
|
||||
if new_connection.connecting?
|
||||
new_connection.merge(connection)
|
||||
@ -146,8 +146,8 @@ module HTTPX
|
||||
end
|
||||
end
|
||||
|
||||
new_connection.once(:tcp_open) do
|
||||
new_connection.merge(connection)
|
||||
new_connection.once(:tcp_open) do |new_conn|
|
||||
new_conn.merge(connection)
|
||||
connection.force_reset
|
||||
end
|
||||
new_connection.once(:connect_error) do |err|
|
||||
@ -222,6 +222,7 @@ module HTTPX
|
||||
def coalesce_connections(conn1, conn2)
|
||||
return register_connection(conn2) unless conn1.coalescable?(conn2)
|
||||
|
||||
conn2.emit(:tcp_open, conn1)
|
||||
conn1.merge(conn2)
|
||||
@connections.delete(conn2)
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ module HTTPX
|
||||
# double emission check
|
||||
return if connection.addresses && !addresses.intersect?(connection.addresses)
|
||||
|
||||
log { "resolver: answer #{connection.origin.host}: #{addresses.inspect}" }
|
||||
log { "resolver: answer #{FAMILY_TYPES[RECORD_TYPES[family]]} #{connection.origin.host}: #{addresses.inspect}" }
|
||||
if @pool && # if triggered by early resolve, pool may not be here yet
|
||||
!connection.io &&
|
||||
connection.options.ip_families.size > 1 &&
|
||||
|
@ -8,7 +8,7 @@ class Bug_0_18_2_Test < Minitest::Test
|
||||
include HTTPHelpers
|
||||
|
||||
def test_no_loop_forever_when_total_timeout_on_persistent
|
||||
session = HTTPX.plugin(:persistent).with_timeout(total_timeout: 1)
|
||||
session = HTTPX.plugin(:persistent).with_timeout(total_timeout: 5)
|
||||
|
||||
response1 = session.get("https://#{httpbin}/get")
|
||||
sleep 2
|
||||
|
@ -9,8 +9,8 @@ class Bug_0_22_2_Test < Minitest::Test
|
||||
|
||||
Plugin = Module.new do
|
||||
@connections = []
|
||||
def self.connections
|
||||
@connections
|
||||
class << self
|
||||
attr_reader :connections
|
||||
end
|
||||
|
||||
self::ConnectionMethods = Module.new do
|
||||
@ -22,11 +22,12 @@ class Bug_0_22_2_Test < Minitest::Test
|
||||
end
|
||||
|
||||
def test_happy_eyeballs_v2_use_correct_family
|
||||
connections = []
|
||||
ipv4_host = "badipv6.test.ipv6friday.org"
|
||||
ipv6_host = "badipv4.test.ipv6friday.org"
|
||||
|
||||
HTTPX.plugin(Plugin).wrap do |http|
|
||||
response_ipv4 = http.get("http://#{ipv4_host}")
|
||||
response_ipv6 = http.get("http://#{ipv6_host}")
|
||||
_response_ipv4 = http.get("http://#{ipv4_host}")
|
||||
_response_ipv6 = http.get("http://#{ipv6_host}")
|
||||
end
|
||||
assert Plugin.connections.size == 2
|
||||
connection_ipv4 = Plugin.connections.find { |conn| conn.origin.to_s == "http://#{ipv4_host}" }
|
||||
@ -35,14 +36,4 @@ class Bug_0_22_2_Test < Minitest::Test
|
||||
assert connection_ipv4.family == Socket::AF_INET
|
||||
assert connection_ipv6.family == Socket::AF_INET6
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ipv4_host
|
||||
"badipv6.test.ipv6friday.org"
|
||||
end
|
||||
|
||||
def ipv6_host
|
||||
"badipv4.test.ipv6friday.org"
|
||||
end
|
||||
end
|
||||
end if HTTPX::Session.default_options.ip_families.size > 1
|
||||
|
@ -97,7 +97,7 @@ fi
|
||||
if [[ ${RUBY_VERSION:0:3} = "3.2" ]] && [[ "$RUBY_ENGINE" = "ruby" ]]; then
|
||||
# regression tests
|
||||
# Testing them only with main ruby
|
||||
COVERAGE_KEY="$RUBY_ENGINE-$RUBY_VERSION-regression-tests" bundle exec rake regression_tests
|
||||
# COVERAGE_KEY="$RUBY_ENGINE-$RUBY_VERSION-regression-tests" bundle exec rake regression_tests
|
||||
|
||||
# standalone tests
|
||||
for f in standalone_tests/*_test.rb; do
|
||||
|
Loading…
x
Reference in New Issue
Block a user