async-http 0.28.0 → 0.28.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/async-http.gemspec +2 -2
- data/lib/async/http/protocol/http2/connection.rb +1 -1
- data/lib/async/http/protocol/http2/request.rb +9 -6
- data/lib/async/http/protocol/http2/stream.rb +11 -8
- data/lib/async/http/url_endpoint.rb +17 -15
- data/lib/async/http/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16e5b6f4cbf9aa5955ae132734d5055076ee5dce533f0aafd4a71ec3812d422a
|
4
|
+
data.tar.gz: 4e0aade981100c1bf1e1b7a1ec71fb72894a60f729262e7090010ca2b7d7f05a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee421022248aa197ef31e1a3b4d7b26c04bbeaea88585ddf628305e2b0736df86035e8f0f980434ec7202af235a00bdce7cb4a6dbcb3469286c41a256acb6aac
|
7
|
+
data.tar.gz: 6385e47d16633c5f183b582951e3f5c4dc454473155c8fb407e7e475f142422a4f0164d60dd8d5090a023bebad9e039ee26e3bc95eff7a1e422167260a817fed
|
data/async-http.gemspec
CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
19
|
spec.add_dependency("async", "~> 1.6")
|
20
|
-
spec.add_dependency("async-io", "~> 1.
|
20
|
+
spec.add_dependency("async-io", "~> 1.15")
|
21
21
|
|
22
|
-
spec.add_dependency("http-protocol", "~> 0.
|
22
|
+
spec.add_dependency("http-protocol", "~> 0.2.0")
|
23
23
|
|
24
24
|
# spec.add_dependency("openssl")
|
25
25
|
|
@@ -77,18 +77,21 @@ module Async
|
|
77
77
|
def receive_reset_stream(stream, error_code)
|
78
78
|
end
|
79
79
|
|
80
|
-
NO_RESPONSE = [
|
80
|
+
NO_RESPONSE = [
|
81
|
+
[STATUS, '500'],
|
82
|
+
[REASON, "No response generated"]
|
83
|
+
]
|
81
84
|
|
82
85
|
def send_response(response)
|
83
86
|
if response.nil?
|
84
87
|
@stream.send_headers(nil, NO_RESPONSE, ::HTTP::Protocol::HTTP2::END_STREAM)
|
85
88
|
else
|
86
|
-
headers = Headers::Merged.new(
|
87
|
-
STATUS
|
88
|
-
REASON
|
89
|
-
|
89
|
+
headers = Headers::Merged.new([
|
90
|
+
[STATUS, response.status],
|
91
|
+
[REASON, response.reason],
|
92
|
+
], response.headers)
|
90
93
|
|
91
|
-
if response.body.nil?
|
94
|
+
if response.body.nil? or response.body.empty?
|
92
95
|
@stream.send_headers(nil, headers, ::HTTP::Protocol::HTTP2::END_STREAM)
|
93
96
|
else
|
94
97
|
@stream.send_headers(nil, headers)
|
@@ -54,35 +54,37 @@ module Async
|
|
54
54
|
chunk = @remainder
|
55
55
|
@remainder = nil
|
56
56
|
elsif chunk = @body.read
|
57
|
+
# There was a new chunk of data to send
|
57
58
|
else
|
58
59
|
@body = nil
|
59
60
|
|
60
61
|
# @body.read above might take a while and a stream reset might be received in the mean time.
|
61
|
-
unless
|
62
|
+
unless closed?
|
62
63
|
send_data(nil, ::HTTP::Protocol::HTTP2::END_STREAM)
|
63
64
|
end
|
64
65
|
|
65
66
|
return false
|
66
67
|
end
|
67
68
|
|
68
|
-
return false if
|
69
|
+
return false if closed?
|
69
70
|
|
70
71
|
if chunk.bytesize <= maximum_size
|
71
72
|
send_data(chunk, maximum_size: maximum_size)
|
72
|
-
|
73
|
-
return true
|
74
73
|
else
|
75
|
-
send_data(chunk.byteslice(0, maximum_size),
|
76
|
-
@remainder = chunk.byteslice(maximum_size, chunk.bytesize - maximum_size)
|
74
|
+
send_data(chunk.byteslice(0, maximum_size), maximum_size: maximum_size)
|
77
75
|
|
78
|
-
|
76
|
+
@remainder = chunk.byteslice(maximum_size, chunk.bytesize - maximum_size)
|
79
77
|
end
|
78
|
+
|
79
|
+
return true
|
80
80
|
end
|
81
81
|
|
82
82
|
def window_updated
|
83
83
|
return unless @body
|
84
84
|
|
85
|
-
while send_chunk
|
85
|
+
while send_chunk
|
86
|
+
# There could be more data to send...
|
87
|
+
end
|
86
88
|
end
|
87
89
|
|
88
90
|
def receive_headers(frame)
|
@@ -108,6 +110,7 @@ module Async
|
|
108
110
|
|
109
111
|
if @body
|
110
112
|
@body.stop(EOFError.new(error_code))
|
113
|
+
@body = nil
|
111
114
|
end
|
112
115
|
|
113
116
|
delegate.receive_reset_stream(self, error_code)
|
@@ -71,17 +71,17 @@ module Async
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def port
|
74
|
-
@url.port || default_port
|
74
|
+
@options[:port] || @url.port || default_port
|
75
75
|
end
|
76
76
|
|
77
77
|
def hostname
|
78
|
-
@options
|
78
|
+
@options[:hostname] || @url.hostname
|
79
79
|
end
|
80
80
|
|
81
81
|
DEFAULT_ALPN_PROTOCOLS = ['h2', 'http/1.1'].freeze
|
82
82
|
|
83
83
|
def alpn_protocols
|
84
|
-
@options
|
84
|
+
@options[:alpn_protocols] || DEFAULT_ALPN_PROTOCOLS
|
85
85
|
end
|
86
86
|
|
87
87
|
def ssl_context
|
@@ -98,20 +98,22 @@ module Async
|
|
98
98
|
{reuse_port: @options[:reuse_port] ? true : false}
|
99
99
|
end
|
100
100
|
|
101
|
-
def endpoint
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
)
|
111
|
-
end
|
101
|
+
def build_endpoint(endpoint = nil)
|
102
|
+
endpoint ||= Async::IO::Endpoint.tcp(hostname, port, tcp_options)
|
103
|
+
|
104
|
+
if secure?
|
105
|
+
# Wrap it in SSL:
|
106
|
+
return Async::IO::SSLEndpoint.new(endpoint,
|
107
|
+
ssl_context: self.ssl_context,
|
108
|
+
hostname: self.hostname
|
109
|
+
)
|
112
110
|
end
|
113
111
|
|
114
|
-
return
|
112
|
+
return endpoint
|
113
|
+
end
|
114
|
+
|
115
|
+
def endpoint
|
116
|
+
@endpoint ||= build_endpoint
|
115
117
|
end
|
116
118
|
|
117
119
|
def bind(*args, &block)
|
data/lib/async/http/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.28.
|
4
|
+
version: 0.28.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.15'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.15'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: http-protocol
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: async-rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|