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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87ea5fdd1668b7c17d499ee05a4d32a295560594c4d6a503c21efd9a3ea82a10
4
- data.tar.gz: a1ad20020eecb10d1d295ba881c02c3cbefe82cb3a2e1d6453ce1cc082823535
3
+ metadata.gz: '092da1fc3f7bb2f725d8e93dc47462ca276ea6d5ff613e2b93fb93ab85ebb9aa'
4
+ data.tar.gz: ea9d3fb54fdd14a7150e764397ae94c81973e7fb3bf6b28ea4462f8b6c9d53c7
5
5
  SHA512:
6
- metadata.gz: 20966b6b196f4429295f9c765734ac52aa90709960fba46955e3769bcb360d820082f6d2555e1d5aa8b821f2f49630e47c592576c80fbc66faccf286915faef9
7
- data.tar.gz: 2ed5fee97702faaf317adfca97c2bc5af6c2e1d21b17856fd8e66109cb7e831ba7f960ea809496038eacff1474b5d2694f7da579b87633dc5260f3d4dca3376e
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
- context.alpn_protocols = @options.fetch(:alpn_protocols, DEFAULT_ALPH_PROTOCOLS)
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
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.15.0"
23
+ VERSION = "0.16.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams