async-http 0.44.0 → 0.45.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2765c2877e0c9ee3f520b0a04a6c67f258abccee76500ebbd18028b279867cc9
4
- data.tar.gz: '06969faca4325c0c2e1c41b503a6cd67900419eb7fcd84481eab24bb019eb1b0'
3
+ metadata.gz: d5e09e728db3e597f9a7b4b9624d13f62c65e9f13937a3f71c12fc8d833c2cdf
4
+ data.tar.gz: 10d32ca9036f5528f13aad1fdedf323406da70f9aff5e58ec6e23207fe53a801
5
5
  SHA512:
6
- metadata.gz: df4f1e508e7f5f4ec112f24f092099189bbd767d3c0397d0544479ad2eb6fc8d94522443e8ef9a3cf01b6916763361742ff0d398a3a545395f5624399d28c6bd
7
- data.tar.gz: 4291820ab6b83d9ab2a23359b689da70ec681f0e494f3832dfeb7bcdffb5a2406ad81c2bda0f9e472bd9e63fabd914e386190551de4be68340e779c8c7a4a09c
6
+ metadata.gz: d48fe23d432ccfec8b61635cdf7e6633a26920b9169b56c40ee5230e059824f2e36c5ad9f0163efd0931f1bc91ad59318b54183488040b9bc72875d6d7be9071
7
+ data.tar.gz: c9faba5394ce276c6f20aac2c4396c1aea37705f2153169edfd1bdeabb2b1afd6fb62fa5c9dff5cb8d439998769dd7e0ac5d84f7df137b168829660643666941
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency("protocol-http", "~> 0.8.0")
23
23
  spec.add_dependency("protocol-http1", "~> 0.8.0")
24
- spec.add_dependency("protocol-http2", "~> 0.4.0")
24
+ spec.add_dependency("protocol-http2", "~> 0.5.0")
25
25
 
26
26
  # spec.add_dependency("openssl")
27
27
 
@@ -38,6 +38,10 @@ module Async
38
38
  super(framer)
39
39
  end
40
40
 
41
+ def create_response
42
+ Response.new(self, self.next_stream_id)
43
+ end
44
+
41
45
  def stop_connection(error)
42
46
  super
43
47
 
@@ -54,10 +58,7 @@ module Async
54
58
 
55
59
  @count += 1
56
60
 
57
- stream_id = next_stream_id
58
- response = Response.new(self, stream_id)
59
- @streams[stream_id] = response.stream
60
-
61
+ response = create_response
61
62
  response.send_request(request)
62
63
  response.wait
63
64
 
@@ -46,16 +46,16 @@ module Async
46
46
  @connection.enable_push?
47
47
  end
48
48
 
49
- def create_promise_stream(headers, stream_id)
50
- request = self.class.new(@connection, stream_id)
51
- @connection.streams[stream_id] = request.stream
52
-
53
- request.receive_headers(self, headers, false)
54
-
55
- return request.stream
49
+ def create_push_promise_stream(headers)
50
+ @connection.create_push_promise_stream do |stream_id|
51
+ request = self.class.new(@connection, stream_id)
52
+
53
+ request.receive_headers(self, headers, false)
54
+ end
56
55
  end
57
56
 
58
- def close
57
+ # Stream state transition into `:closed`.
58
+ def close!
59
59
  end
60
60
 
61
61
  # @return [Stream] the promised stream, on which to send data.
@@ -46,16 +46,16 @@ module Async
46
46
  @promises ||= Async::Queue.new
47
47
  end
48
48
 
49
- def create_promise_stream(headers, stream_id)
50
- promise = Promise.new(@connection, headers, stream_id)
51
- @connection.streams[stream_id] = promise.stream
52
-
53
- self.promises.enqueue(promise)
54
-
55
- return promise.stream
49
+ def accept_push_promise_stream(promised_stream_id, headers)
50
+ @connection.accept_push_promise_stream(promised_stream_id) do
51
+ promise = Promise.new(@connection, headers, promised_stream_id)
52
+
53
+ self.promises.enqueue(promise)
54
+ end
56
55
  end
57
56
 
58
- def close
57
+ # Stream state transition into `:closed`.
58
+ def close!
59
59
  self.promises.enqueue(nil)
60
60
  end
61
61
 
@@ -43,12 +43,11 @@ module Async
43
43
 
44
44
  attr :requests
45
45
 
46
- def create_stream(stream_id)
47
- request = Request.new(self, stream_id)
48
-
49
- @streams[stream_id] = request.stream
50
-
51
- return request.stream
46
+ # A new request has come in:
47
+ def accept_stream(stream_id)
48
+ super do
49
+ Request.new(self, stream_id)
50
+ end
52
51
  end
53
52
 
54
53
  def stop_connection(error)
@@ -39,14 +39,18 @@ module Async
39
39
  attr_accessor :delegate
40
40
  attr :body
41
41
 
42
- def create_promise_stream(headers, stream_id)
43
- @delegate.create_promise_stream(headers, stream_id)
42
+ def create_push_promise_stream(headers)
43
+ @delegate.create_push_promise_stream(headers)
44
44
  end
45
45
 
46
- def close(state = :closed)
46
+ def accept_push_promise_stream(headers, stream_id)
47
+ @delegate.accept_push_promise_stream(headers, stream_id)
48
+ end
49
+
50
+ def close!
47
51
  super
48
52
 
49
- @delegate.close
53
+ @delegate.close!
50
54
  end
51
55
 
52
56
  def send_body(body, task: Async::Task.current)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.44.0"
23
+ VERSION = "0.45.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.44.0
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.4.0
75
+ version: 0.5.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.4.0
82
+ version: 0.5.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: async-rspec
85
85
  requirement: !ruby/object:Gem::Requirement