async-http 0.46.0 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async/http/endpoint.rb +8 -7
- data/lib/async/http/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b7db0313fc3a2dbd5e6e129b383978c401cd8d29d3526a1b04b9f1e51c639fb
|
4
|
+
data.tar.gz: d7216cd01e4b8fab066c955bf78f42dacd6e4fa0545c28cdea768b8e136bde33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992e488841e226605b85cf8677df82d26407018e1c6d23c9914e2537b254a25f099e7b3c1d00109c9e507a57ae7a2be78ab34230823b1da7316de73ed316134b
|
7
|
+
data.tar.gz: c6c00d4f294a54f3d243534bf207a0a806ddaa83412f39102488f59c0d83094648051f200020011a469acf2da2c83d6701fe065ca0b11e9e019d18c2506b8ec8
|
data/lib/async/http/endpoint.rb
CHANGED
@@ -36,8 +36,8 @@ module Async
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# @option scheme [String] the scheme to use, overrides the URL scheme.
|
39
|
+
# @option hostname [String] the hostname to connect to (or bind to), overrides the URL hostname (used for SNI).
|
39
40
|
# @option port [Integer] the port to bind to, overrides the URL port.
|
40
|
-
# @option hostname [String] the hostname to use, overrides the URL hostname.
|
41
41
|
# @option ssl_context [OpenSSL::SSL::SSLContext] the context to use for TLS.
|
42
42
|
# @option alpn_protocols [Array<String>] the alpn protocols to negotiate.
|
43
43
|
def initialize(url, endpoint = nil, **options)
|
@@ -60,7 +60,7 @@ module Async
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def to_s
|
63
|
-
"\#<#{self.class} #{self.to_url}>"
|
63
|
+
"\#<#{self.class} #{self.to_url} #{@options}>"
|
64
64
|
end
|
65
65
|
|
66
66
|
def inspect
|
@@ -99,6 +99,7 @@ module Async
|
|
99
99
|
@options[:port] || @url.port || default_port
|
100
100
|
end
|
101
101
|
|
102
|
+
# The hostname is the server we are connecting to:
|
102
103
|
def hostname
|
103
104
|
@options[:hostname] || @url.hostname
|
104
105
|
end
|
@@ -109,9 +110,9 @@ module Async
|
|
109
110
|
|
110
111
|
def authority
|
111
112
|
if default_port?
|
112
|
-
hostname
|
113
|
+
@url.hostname
|
113
114
|
else
|
114
|
-
"#{hostname}:#{port}"
|
115
|
+
"#{@url.hostname}:#{port}"
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
@@ -131,7 +132,7 @@ module Async
|
|
131
132
|
end
|
132
133
|
|
133
134
|
def localhost?
|
134
|
-
|
135
|
+
@url.hostname =~ /^(.*?\.)?localhost\.?$/
|
135
136
|
end
|
136
137
|
|
137
138
|
# We don't try to validate peer certificates when talking to localhost because they would always be self-signed.
|
@@ -169,13 +170,13 @@ module Async
|
|
169
170
|
end
|
170
171
|
|
171
172
|
def build_endpoint(endpoint = nil)
|
172
|
-
endpoint ||= Async::IO::Endpoint.tcp(hostname, port, tcp_options)
|
173
|
+
endpoint ||= Async::IO::Endpoint.tcp(self.hostname, port, tcp_options)
|
173
174
|
|
174
175
|
if secure?
|
175
176
|
# Wrap it in SSL:
|
176
177
|
return Async::IO::SSLEndpoint.new(endpoint,
|
177
178
|
ssl_context: self.ssl_context,
|
178
|
-
hostname:
|
179
|
+
hostname: @url.hostname,
|
179
180
|
timeout: self.timeout,
|
180
181
|
)
|
181
182
|
end
|
data/lib/async/http/version.rb
CHANGED