async-http 0.43.0 → 0.43.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -2
- data/.travis.yml +9 -7
- data/Gemfile +0 -5
- data/async-http.gemspec +1 -0
- data/lib/async/http/protocol/http1/response.rb +1 -0
- data/lib/async/http/protocol/http2.rb +0 -1
- data/lib/async/http/protocol/http2/client.rb +2 -2
- data/lib/async/http/protocol/http2/connection.rb +13 -3
- data/lib/async/http/protocol/http2/request.rb +5 -6
- data/lib/async/http/protocol/http2/response.rb +0 -2
- data/lib/async/http/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 901472f2bea3d4389d6ac6adab0b2e78a86991e10da7a2e92a3fbae69f66e9a8
|
4
|
+
data.tar.gz: df036f736d8314edf42f784b159acfc2fd7c755294aae26130f23fcd5187a49b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 379eb7bf5cb3ee6ee187989789869274e6f21fdf4fd5cfe60d0c492cec037898147675eac89b9974d7ecc99138664202628d330c66a00cddda4a3090b7285e2f
|
7
|
+
data.tar.gz: e1a8232a2f28032cc5ba057b0be010f4fc807e3e6f824dfa84507eb50272106d5d80d0f45b7e7f810ef4bac6c6d7d2be910280cc00f45487af42c8b1de194678
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -2,28 +2,30 @@ language: ruby
|
|
2
2
|
dist: xenial
|
3
3
|
cache: bundler
|
4
4
|
|
5
|
-
before_install:
|
6
|
-
- gem update --system
|
7
|
-
- gem install bundler
|
8
|
-
|
9
5
|
addons:
|
10
6
|
apt:
|
11
7
|
packages:
|
12
8
|
- wrk
|
13
9
|
- apache2-utils
|
10
|
+
homebrew:
|
11
|
+
packages:
|
12
|
+
- wrk
|
14
13
|
|
15
14
|
matrix:
|
16
15
|
include:
|
17
16
|
- rvm: 2.4
|
18
17
|
- rvm: 2.5
|
19
18
|
- rvm: 2.6
|
19
|
+
- rvm: 2.6
|
20
|
+
env: COVERAGE=Summary,Coveralls
|
20
21
|
- rvm: truffleruby
|
21
22
|
- rvm: jruby-head
|
22
23
|
env: JRUBY_OPTS="--debug -X+O"
|
23
24
|
- rvm: ruby-head
|
24
|
-
- rvm:
|
25
|
+
- rvm: 2.6
|
26
|
+
os: osx
|
25
27
|
allow_failures:
|
26
|
-
- rvm: ruby-head
|
27
28
|
- rvm: truffleruby
|
29
|
+
- rvm: ruby-head
|
28
30
|
- rvm: jruby-head
|
29
|
-
- rvm:
|
31
|
+
- rvm: truffleruby
|
data/Gemfile
CHANGED
data/async-http.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "async-rspec", "~> 1.10"
|
29
29
|
spec.add_development_dependency "async-container", "~> 0.5.0"
|
30
30
|
|
31
|
+
spec.add_development_dependency "covered"
|
31
32
|
spec.add_development_dependency "bundler"
|
32
33
|
spec.add_development_dependency "rspec", "~> 3.6"
|
33
34
|
spec.add_development_dependency "rake"
|
@@ -40,7 +40,6 @@ module Async
|
|
40
40
|
}
|
41
41
|
|
42
42
|
SERVER_SETTINGS = {
|
43
|
-
::Protocol::HTTP2::Settings::ENABLE_PUSH => 1,
|
44
43
|
# We choose a lower maximum concurrent streams to avoid overloading a single connection/thread.
|
45
44
|
::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 32,
|
46
45
|
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
|
@@ -48,12 +48,12 @@ module Async
|
|
48
48
|
|
49
49
|
# Used by the client to send requests to the remote server.
|
50
50
|
def call(request)
|
51
|
+
raise ::Protocol::HTTP2::Error, "Connection closed!" if self.closed?
|
52
|
+
|
51
53
|
@count += 1
|
52
54
|
|
53
55
|
response = Response.new(self, next_stream_id)
|
54
|
-
|
55
56
|
response.send_request(request)
|
56
|
-
|
57
57
|
response.wait
|
58
58
|
|
59
59
|
return response
|
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
require_relative 'stream'
|
22
22
|
|
23
|
+
require 'async/semaphore'
|
24
|
+
|
23
25
|
module Async
|
24
26
|
module HTTP
|
25
27
|
module Protocol
|
@@ -29,7 +31,6 @@ module Async
|
|
29
31
|
METHOD = ':method'.freeze
|
30
32
|
PATH = ':path'.freeze
|
31
33
|
AUTHORITY = ':authority'.freeze
|
32
|
-
REASON = 'reason'.freeze
|
33
34
|
STATUS = ':status'.freeze
|
34
35
|
PROTOCOL = ':protocol'.freeze
|
35
36
|
|
@@ -41,6 +42,9 @@ module Async
|
|
41
42
|
|
42
43
|
@count = 0
|
43
44
|
@reader = nil
|
45
|
+
|
46
|
+
# Writing multiple frames at the same time can cause odd problems if frames are only partially written. So we use a semaphore to ensure frames are written in their entirety.
|
47
|
+
@write_frame_guard = Async::Semaphore.new(1)
|
44
48
|
end
|
45
49
|
|
46
50
|
attr :stream
|
@@ -61,13 +65,19 @@ module Async
|
|
61
65
|
@reader = nil
|
62
66
|
end
|
63
67
|
|
68
|
+
def write_frame(frame)
|
69
|
+
# We don't want to write multiple frames at the same time.
|
70
|
+
@write_frame_guard.acquire do
|
71
|
+
super
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
64
75
|
def read_in_background(task: Task.current)
|
65
76
|
task.async do |nested_task|
|
66
77
|
nested_task.annotate("#{version} reading data for #{self.class}")
|
67
78
|
|
68
79
|
begin
|
69
|
-
|
70
|
-
while !@stream.closed?
|
80
|
+
while !self.closed?
|
71
81
|
self.read_frame
|
72
82
|
end
|
73
83
|
ensure
|
@@ -127,7 +127,6 @@ module Async
|
|
127
127
|
|
128
128
|
NO_RESPONSE = [
|
129
129
|
[STATUS, '500'],
|
130
|
-
[REASON, "No response generated"]
|
131
130
|
]
|
132
131
|
|
133
132
|
def send_response(response)
|
@@ -138,14 +137,14 @@ module Async
|
|
138
137
|
[STATUS, response.status],
|
139
138
|
]
|
140
139
|
|
141
|
-
if length = response.body.length
|
142
|
-
pseudo_headers << [CONTENT_LENGTH, length]
|
143
|
-
end
|
144
|
-
|
145
140
|
if protocol = response.protocol
|
146
141
|
pseudo_headers << [PROTOCOL, protocol]
|
147
142
|
end
|
148
143
|
|
144
|
+
if length = response.body.length
|
145
|
+
pseudo_headers << [CONTENT_LENGTH, length]
|
146
|
+
end
|
147
|
+
|
149
148
|
headers = ::Protocol::HTTP::Headers::Merged.new(
|
150
149
|
pseudo_headers,
|
151
150
|
response.headers
|
@@ -154,7 +153,7 @@ module Async
|
|
154
153
|
@stream.send_headers(nil, headers)
|
155
154
|
@stream.send_body(response.body)
|
156
155
|
else
|
157
|
-
headers = Headers::Merged.new([
|
156
|
+
headers = ::Protocol::HTTP::Headers::Merged.new([
|
158
157
|
[STATUS, response.status],
|
159
158
|
], response.headers)
|
160
159
|
|
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.43.
|
4
|
+
version: 0.43.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: 2019-06-
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.5.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: covered
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: bundler
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|