Open pooled push connections as a Net::HTTP subclass that includes Stages

WebPush::Connections mixed Stages into each new connection with
`http.extend Stages` just before starting it. The connection is built in
one place, WebPush::PersistentRequest, so it can be built from a class
that already includes Stages: the same method lookup, without giving
every pooled connection its own singleton class. Connections#request
now also refuses a connection that isn't one, so a caller that builds a
plain Net::HTTP gets the ArgumentError rather than a connection whose
failures can't be told apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sam RubyandClaude Opus 5.5 authored and Rosa Gutierrez committed 2026-10-09 23:41:45 +02:00
1 parent 2d4b05a74a
commit 2daa01e26b
3 files changed
+9 -4

No files matched your search

@@ -109,7 +109,7 @@ module PushServiceTestHelper
# Built as WebPush::PersistentRequest builds it for a delivery.
def pinned_connection(server, ip = IP)
Net::HTTP.new(HOST, server.port, nil).tap do |http|
WebPush::Connections::HTTP.new(HOST, server.port, nil).tap do |http|
http.ipaddr = ip
http.use_ssl = true
end