async-http 0.45.3 → 0.45.4

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: 073c1c14dca42ab8bcba5767b43ca38b6a892dedc86f213686ca234ffe434d0b
4
- data.tar.gz: 1514a0f44b080ff99a3ffe6e1dda5f7a469f2d279b6eda9bb736ec3a98a69e4e
3
+ metadata.gz: af620d4e3e885af7b094634cd875459b5613999af8b80464dc52fbc92108d7cb
4
+ data.tar.gz: a56bea4149a58c74f2830d31f62ef308720a51887574aab81087ebfb095502f6
5
5
  SHA512:
6
- metadata.gz: b7ca4788c88980222895de4e2acc7051d9e52a30c20e55ee51f9211c0ab9d811d564688e28d056851705e25e231ef559930b8f606e8d6b33df95e3f80d6d2a2f
7
- data.tar.gz: 5dff2d132ed8859102f50d646f5ab020c6d44f1522438822b87594a8ae3614b3373435c151818a1f2a177763f78c451e38e7d17550c72a03d40757b47affb8c1
6
+ metadata.gz: 16bd6f0a463a8fe62e14054fc9918df817a7937f7a172b9c4d5266e588143db6c86ea3d34b83e89dbf77bfe3fc0be3e76cb1b0e0a60e73f6620a251e5768caca
7
+ data.tar.gz: bdce788539eab5560fb489b7ff9d631218f5fdbaf0c0602d8b054b9bbc43cea6743897c73ff332abd8138fb5e41e711539f96308291d9da6885dc3b291d14cfb
@@ -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.5.0")
24
+ spec.add_dependency("protocol-http2", "~> 0.6.0")
25
25
 
26
26
  # spec.add_dependency("openssl")
27
27
 
@@ -42,16 +42,6 @@ module Async
42
42
  Response.new(self, self.next_stream_id)
43
43
  end
44
44
 
45
- def stop_connection(error)
46
- super
47
-
48
- @streams.each do |id, stream|
49
- if stream.respond_to?(:stop_connection)
50
- stream.stop_connection(error)
51
- end
52
- end
53
- end
54
-
55
45
  # Used by the client to send requests to the remote server.
56
46
  def call(request)
57
47
  raise ::Protocol::HTTP2::Error, "Connection closed!" if self.closed?
@@ -61,8 +61,10 @@ module Async
61
61
  @reader ||= read_in_background
62
62
  end
63
63
 
64
- def stop_connection(error)
64
+ def close(error = nil)
65
65
  @reader = nil
66
+
67
+ super
66
68
  end
67
69
 
68
70
  def write_frame(frame)
@@ -81,9 +83,9 @@ module Async
81
83
  self.read_frame
82
84
  end
83
85
  rescue EOFError, Async::Wrapper::Cancelled
84
- # Stream closed.
86
+ # Ignore.
85
87
  ensure
86
- stop_connection($!)
88
+ close($!)
87
89
  end
88
90
  end
89
91
  end
@@ -58,6 +58,13 @@ module Async
58
58
  def close!
59
59
  end
60
60
 
61
+ def stream_closed(error)
62
+ if @input
63
+ @input.close(error)
64
+ @input = nil
65
+ end
66
+ end
67
+
61
68
  # @return [Stream] the promised stream, on which to send data.
62
69
  def push(path, headers = nil)
63
70
  push_headers = [
@@ -134,9 +141,6 @@ module Async
134
141
  def receive_reset_stream(stream, error_code)
135
142
  end
136
143
 
137
- def stop_connection(error)
138
- end
139
-
140
144
  NO_RESPONSE = [
141
145
  [STATUS, '500'],
142
146
  ]
@@ -124,7 +124,7 @@ module Async
124
124
  notify!
125
125
  end
126
126
 
127
- def stop_connection(error)
127
+ def stream_closed(error)
128
128
  @exception = error
129
129
 
130
130
  notify!
@@ -50,7 +50,7 @@ module Async
50
50
  end
51
51
  end
52
52
 
53
- def stop_connection(error)
53
+ def close(error = nil)
54
54
  super
55
55
 
56
56
  @requests.enqueue nil
@@ -30,9 +30,13 @@ module Async
30
30
 
31
31
  @delegate = delegate
32
32
 
33
- @body = body
33
+ # This is the body that is being sent.
34
+ @body = nil
35
+
36
+ # The remainder of the current chunk being sent.
34
37
  @remainder = nil
35
38
 
39
+ # The task that is handling sending the body.
36
40
  @task = nil
37
41
  end
38
42
 
@@ -47,12 +51,6 @@ module Async
47
51
  @delegate.accept_push_promise_stream(headers, stream_id)
48
52
  end
49
53
 
50
- def close!
51
- super
52
-
53
- @delegate.close!
54
- end
55
-
56
54
  def send_body(body, task: Async::Task.current)
57
55
  # TODO Might need to stop this task when body is cancelled.
58
56
  @task = task.async do |subtask|
@@ -142,13 +140,21 @@ module Async
142
140
  return error_code
143
141
  end
144
142
 
145
- def stop_connection(error)
143
+ def close!
144
+ @delegate.close!
145
+
146
+ super
147
+ end
148
+
149
+ def close(error = nil)
150
+ super
151
+
146
152
  if @body
147
153
  @body.close(error)
148
154
  @body = nil
149
155
  end
150
156
 
151
- @delegate.stop_connection(error)
157
+ @delegate.stream_closed(error)
152
158
  end
153
159
  end
154
160
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.45.3"
23
+ VERSION = "0.45.4"
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.45.3
4
+ version: 0.45.4
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.5.0
75
+ version: 0.6.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.5.0
82
+ version: 0.6.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: async-rspec
85
85
  requirement: !ruby/object:Gem::Requirement