async-http 0.15.0 → 0.16.0
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/protocol/https.rb +12 -0
- data/lib/async/http/url_endpoint.rb +13 -3
- 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: '092da1fc3f7bb2f725d8e93dc47462ca276ea6d5ff613e2b93fb93ab85ebb9aa'
|
4
|
+
data.tar.gz: ea9d3fb54fdd14a7150e764397ae94c81973e7fb3bf6b28ea4462f8b6c9d53c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f44d4558088cecd292fcb276ea035118c587a0a0c9c25c3c5cf69b43d3924abc7f6b0abcecf5a9cf23aa04b9f530816d1f8e7dc6833c215e443f893bd0a6c6f
|
7
|
+
data.tar.gz: 2c5bb797ba153a6bb224457e4b3304b08b0af39b21816e1a43fc2e01aa41970cc94e21fca4ee0914a61bab672d41ba862249776222051d564e59a2314c52001f
|
@@ -27,6 +27,18 @@ require 'openssl'
|
|
27
27
|
|
28
28
|
unless OpenSSL::SSL::SSLContext.instance_methods.include? :alpn_protocols=
|
29
29
|
warn "OpenSSL implementation doesn't support ALPN."
|
30
|
+
|
31
|
+
class OpenSSL::SSL::SSLContext
|
32
|
+
def alpn_protocols= names
|
33
|
+
return names
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class OpenSSL::SSL::SSLSocket
|
38
|
+
def alpn_protocol
|
39
|
+
return nil
|
40
|
+
end
|
41
|
+
end
|
30
42
|
end
|
31
43
|
|
32
44
|
module Async
|
@@ -21,11 +21,12 @@
|
|
21
21
|
require 'async/io/endpoint'
|
22
22
|
require 'async/io/ssl_socket'
|
23
23
|
|
24
|
+
require_relative 'protocol/http1'
|
25
|
+
require_relative 'protocol/https'
|
26
|
+
|
24
27
|
module Async
|
25
28
|
module HTTP
|
26
29
|
class URLEndpoint < Async::IO::Endpoint
|
27
|
-
DEFAULT_ALPH_PROTOCOLS = ['h2', 'http/1.1'].freeze
|
28
|
-
|
29
30
|
def self.parse(string, **options)
|
30
31
|
self.new(URI.parse(string), **options)
|
31
32
|
end
|
@@ -72,9 +73,18 @@ module Async
|
|
72
73
|
@options.fetch(:hostname, @url.hostname)
|
73
74
|
end
|
74
75
|
|
76
|
+
DEFAULT_ALPN_PROTOCOLS = ['h2', 'http/1.1'].freeze
|
77
|
+
|
78
|
+
def alpn_protocols
|
79
|
+
@options.fetch(:alpn_protocols, DEFAULT_ALPN_PROTOCOLS)
|
80
|
+
end
|
81
|
+
|
75
82
|
def ssl_context
|
76
83
|
@options[:ssl_context] || ::OpenSSL::SSL::SSLContext.new.tap do |context|
|
77
|
-
|
84
|
+
if alpn_protocols = self.alpn_protocols
|
85
|
+
context.alpn_protocols = alpn_protocols
|
86
|
+
end
|
87
|
+
|
78
88
|
context.set_params
|
79
89
|
end
|
80
90
|
end
|
data/lib/async/http/version.rb
CHANGED