@@ -181,7 +181,7 @@ class Net::HTTP::Persistent
181
181
##
182
182
# The version of Net::HTTP::Persistent you are using
183
183
184
- VERSION = '4.0.5 '
184
+ VERSION = '4.0.6 '
185
185
186
186
##
187
187
# Error class for errors raised by Net::HTTP::Persistent. Various
@@ -630,47 +630,49 @@ def connection_for uri
630
630
631
631
connection = @pool . checkout net_http_args
632
632
633
- http = connection . http
633
+ begin
634
+ http = connection . http
634
635
635
- connection . ressl @ssl_generation if
636
- connection . ssl_generation != @ssl_generation
636
+ connection . ressl @ssl_generation if
637
+ connection . ssl_generation != @ssl_generation
637
638
638
- if not http . started? then
639
- ssl http if use_ssl
640
- start http
641
- elsif expired? connection then
642
- reset connection
643
- end
639
+ if not http . started? then
640
+ ssl http if use_ssl
641
+ start http
642
+ elsif expired? connection then
643
+ reset connection
644
+ end
644
645
645
- http . keep_alive_timeout = @idle_timeout if @idle_timeout
646
- http . max_retries = @max_retries if http . respond_to? ( :max_retries= )
647
- http . read_timeout = @read_timeout if @read_timeout
648
- http . write_timeout = @write_timeout if
649
- @write_timeout && http . respond_to? ( :write_timeout= )
646
+ http . keep_alive_timeout = @idle_timeout if @idle_timeout
647
+ http . max_retries = @max_retries if http . respond_to? ( :max_retries= )
648
+ http . read_timeout = @read_timeout if @read_timeout
649
+ http . write_timeout = @write_timeout if
650
+ @write_timeout && http . respond_to? ( :write_timeout= )
651
+
652
+ return yield connection
653
+ rescue Errno ::ECONNREFUSED
654
+ if http . proxy?
655
+ address = http . proxy_address
656
+ port = http . proxy_port
657
+ else
658
+ address = http . address
659
+ port = http . port
660
+ end
650
661
651
- return yield connection
652
- rescue Errno ::ECONNREFUSED
653
- if http . proxy?
654
- address = http . proxy_address
655
- port = http . proxy_port
656
- else
657
- address = http . address
658
- port = http . port
659
- end
662
+ raise Error , " connection refused: #{ address } : #{ port } "
663
+ rescue Errno ::EHOSTDOWN
664
+ if http . proxy?
665
+ address = http . proxy_address
666
+ port = http . proxy_port
667
+ else
668
+ address = http . address
669
+ port = http . port
670
+ end
660
671
661
- raise Error , "connection refused: #{ address } :#{ port } "
662
- rescue Errno ::EHOSTDOWN
663
- if http . proxy?
664
- address = http . proxy_address
665
- port = http . proxy_port
666
- else
667
- address = http . address
668
- port = http . port
672
+ raise Error , "host down: #{ address } :#{ port } "
673
+ ensure
674
+ @pool . checkin net_http_args
669
675
end
670
-
671
- raise Error , "host down: #{ address } :#{ port } "
672
- ensure
673
- @pool . checkin net_http_args
674
676
end
675
677
676
678
##
0 commit comments