lib/httpx/session.rb in httpx-1.2.2 vs lib/httpx/session.rb in httpx-1.2.3
- old
+ new
@@ -136,11 +136,11 @@
request.emit(:response, ErrorResponse.new(request, error, options))
end
# sets the callbacks on the +connection+ required to process certain specific
# connection lifecycle events which deal with request rerouting.
- def set_connection_callbacks(connection, connections, options)
+ def set_connection_callbacks(connection, connections, options, cloned: false)
connection.only(:misdirected) do |misdirected_request|
other_connection = connection.create_idle(ssl: { alpn_protocols: %w[http/1.1] })
other_connection.merge(connection)
catch(:coalesced) do
pool.init_connection(other_connection, options)
@@ -152,9 +152,13 @@
end
connection.only(:altsvc) do |alt_origin, origin, alt_params|
other_connection = build_altsvc_connection(connection, connections, alt_origin, origin, alt_params, options)
connections << other_connection if other_connection
end
+ connection.only(:cloned) do |cloned_conn|
+ set_connection_callbacks(cloned_conn, connections, options, cloned: true)
+ connections << cloned_conn
+ end unless cloned
end
# returns an HTTPX::Connection for the negotiated Alternative Service (or none).
def build_altsvc_connection(existing_connection, connections, alt_origin, origin, alt_params, options)
# do not allow security downgrades on altsvc negotiation