⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (1019 Bytes)
Bug #10467
ยป test.rb
dissolve (Ben Roberts)
, 11/02/2014 03:44 PM
require
'net/http'
uris
=
[
URI
(
'https://www.google.com/'
),
#server with SSL
URI
(
'https://david.shanske.com/'
),
#server with SNI (that isn't the default)
URI
(
'https://ben.thatmustbe.me/'
)
#server with SNI (that is the default)
]
connections
=
uris
.
map
{
|
uri
|
Net
::
HTTP
.
start
(
uri
.
host
,
uri
.
port
,
:use_ssl
=>
uri
.
scheme
==
'https'
)}
requests
=
uris
.
map
{
|
uri
|
Net
::
HTTP
::
Get
.
new
uri
}
0
.
upto
(
uris
.
length
-
1
)
do
|
idx
|
begin
connections
[
idx
].
request
requests
[
idx
]
puts
"connect
#{
connections
[
idx
].
address
}
OK"
rescue
=>
e
puts
"Error on connection to
#{
connections
[
idx
].
address
}
before timeout:
#{
e
.
message
}
"
puts
"Exiting as this does not prove anything"
exit
end
end
sleep
300
0
.
upto
(
uris
.
length
-
1
)
do
|
idx
|
begin
connections
[
idx
].
request
requests
[
idx
]
puts
"reconnect
#{
connections
[
idx
].
address
}
OK"
rescue
=>
e
puts
"Error on reconnection to
#{
connections
[
idx
].
address
}
after timeout:
#{
e
.
message
}
"
end
end
(1-1/1)
Loading...