async-http 0.50.8 → 0.50.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/async-http.gemspec +3 -5
- data/examples/download/chunked.rb +3 -1
- data/examples/fetch/Gemfile +0 -1
- data/examples/fetch/config.ru +0 -1
- data/examples/google/search.rb +5 -3
- data/lib/async/http/client.rb +1 -1
- data/lib/async/http/protocol/http2.rb +4 -4
- data/lib/async/http/version.rb +1 -1
- metadata +9 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adaf496a96262a69c126558cde8463995949b75dc3f663ab068ca47e982a80e8
|
4
|
+
data.tar.gz: d4872a7d08166ac5924d984c7883a9ccbd87b923f1d5ba593899d7917f5564a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd5488f4658ae99753d09af39c5a1aabd4a1b2edd24837e5f023fea812c198e3b4e8a0879df5f5f823ff864a6095c5f6d20adda9ca4e61237272544bdee16c6
|
7
|
+
data.tar.gz: d0f64c4635d26f825fba0cc710388a5857469d68771335672a29bba55c0f454e35e3c9c7694aec9d101b2d4243a3e7ef3295b690e293dcbc8622b3be44f4c0f6
|
data/.travis.yml
CHANGED
@@ -15,7 +15,6 @@ script: bundle exec rspec
|
|
15
15
|
|
16
16
|
matrix:
|
17
17
|
include:
|
18
|
-
- rvm: 2.4
|
19
18
|
- rvm: 2.5
|
20
19
|
- rvm: 2.6
|
21
20
|
- rvm: 2.7
|
@@ -28,7 +27,6 @@ matrix:
|
|
28
27
|
- rvm: 2.7
|
29
28
|
os: osx
|
30
29
|
allow_failures:
|
31
|
-
- rvm: truffleruby
|
32
30
|
- rvm: ruby-head
|
33
31
|
- rvm: jruby-head
|
34
32
|
- rvm: truffleruby
|
data/async-http.gemspec
CHANGED
@@ -18,24 +18,22 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency("async", "~> 1.23")
|
21
|
-
spec.add_dependency("async-io", "~> 1.
|
21
|
+
spec.add_dependency("async-io", "~> 1.28")
|
22
22
|
spec.add_dependency("async-pool", "~> 0.2")
|
23
23
|
|
24
24
|
spec.add_dependency("protocol-http", "~> 0.15.1")
|
25
25
|
spec.add_dependency("protocol-http1", "~> 0.10.0")
|
26
|
-
spec.add_dependency("protocol-http2", "~> 0.
|
26
|
+
spec.add_dependency("protocol-http2", "~> 0.12.0")
|
27
27
|
|
28
28
|
# spec.add_dependency("openssl")
|
29
29
|
|
30
|
-
spec.add_development_dependency "bake-bundler"
|
31
|
-
|
32
30
|
spec.add_development_dependency "async-rspec", "~> 1.10"
|
33
31
|
spec.add_development_dependency "async-container", "~> 0.14.0"
|
34
32
|
|
35
33
|
spec.add_development_dependency "rack-test"
|
36
34
|
|
37
|
-
spec.add_development_dependency "bake"
|
38
35
|
spec.add_development_dependency "covered"
|
39
36
|
spec.add_development_dependency "bundler"
|
37
|
+
spec.add_development_dependency "bake-bundler"
|
40
38
|
spec.add_development_dependency "rspec", "~> 3.6"
|
41
39
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'async'
|
4
4
|
require 'async/clock'
|
5
5
|
require 'async/barrier'
|
6
|
+
require 'async/semaphore'
|
6
7
|
require_relative '../../lib/async/http/endpoint'
|
7
8
|
require_relative '../../lib/async/http/client'
|
8
9
|
|
@@ -53,7 +54,8 @@ Async do
|
|
53
54
|
|
54
55
|
Async.logger.info(self) {"Breaking download into #{parts.size} parts..."}
|
55
56
|
|
56
|
-
|
57
|
+
semaphore = Async::Semaphore.new(8)
|
58
|
+
barrier = Async::Barrier.new(parent: semaphore)
|
57
59
|
|
58
60
|
while !parts.empty?
|
59
61
|
barrier.async do
|
data/examples/fetch/Gemfile
CHANGED
data/examples/fetch/config.ru
CHANGED
data/examples/google/search.rb
CHANGED
@@ -8,6 +8,8 @@ require_relative "../../lib/async/http"
|
|
8
8
|
URL = "https://www.google.com/search"
|
9
9
|
ENDPOINT = Async::HTTP::Endpoint.parse(URL)
|
10
10
|
|
11
|
+
# Console.logger.enable(Async::IO::Stream, Console::Logger::DEBUG)
|
12
|
+
|
11
13
|
class Google < Protocol::HTTP::Middleware
|
12
14
|
def search(term)
|
13
15
|
Async.logger.info(self) {"Searching for #{term}..."}
|
@@ -18,7 +20,7 @@ end
|
|
18
20
|
|
19
21
|
terms = %w{thoughtful fear size payment lethal modern recognise face morning sulky mountainous contain science snow uncle skirt truthful door travel snails closed rotten halting creator teeny-tiny beautiful cherries unruly level follow strip team things suggest pretty warm end cannon bad pig consider airport strengthen youthful fog three walk furry pickle moaning fax book ruddy sigh plate cakes shame stem faulty bushes dislike train sleet one colour behavior bitter suit count loutish squeak learn watery orange idiotic seat wholesale omniscient nostalgic arithmetic instruct committee puffy program cream cake whistle rely encourage war flagrant amusing fluffy prick utter wacky occur daily son check}
|
20
22
|
|
21
|
-
if count = ENV
|
23
|
+
if count = ENV.fetch('COUNT', 20)&.to_i
|
22
24
|
terms = terms.first(count)
|
23
25
|
end
|
24
26
|
|
@@ -36,10 +38,10 @@ Async do |task|
|
|
36
38
|
end
|
37
39
|
end.map(&:wait).to_h
|
38
40
|
|
39
|
-
|
41
|
+
Async.logger.info(self, name: 'counts') {counts}
|
40
42
|
end
|
41
43
|
|
42
|
-
|
44
|
+
Async.logger.info(self, name: 'duration') {duration}
|
43
45
|
ensure
|
44
46
|
google.close
|
45
47
|
end
|
data/lib/async/http/client.rb
CHANGED
@@ -36,19 +36,19 @@ module Async
|
|
36
36
|
CLIENT_SETTINGS = {
|
37
37
|
::Protocol::HTTP2::Settings::ENABLE_PUSH => 0,
|
38
38
|
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
|
39
|
-
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE =>
|
39
|
+
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000,
|
40
40
|
}
|
41
41
|
|
42
42
|
SERVER_SETTINGS = {
|
43
43
|
# We choose a lower maximum concurrent streams to avoid overloading a single connection/thread.
|
44
44
|
::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 128,
|
45
45
|
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
|
46
|
-
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE =>
|
46
|
+
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000,
|
47
47
|
::Protocol::HTTP2::Settings::ENABLE_CONNECT_PROTOCOL => 1,
|
48
48
|
}
|
49
49
|
|
50
50
|
def self.client(peer, settings = CLIENT_SETTINGS)
|
51
|
-
stream = IO::Stream.new(peer, sync: true
|
51
|
+
stream = IO::Stream.new(peer, sync: true)
|
52
52
|
|
53
53
|
client = Client.new(stream)
|
54
54
|
|
@@ -59,7 +59,7 @@ module Async
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.server(peer, settings = SERVER_SETTINGS)
|
62
|
-
stream = IO::Stream.new(peer, sync: true
|
62
|
+
stream = IO::Stream.new(peer, sync: true)
|
63
63
|
|
64
64
|
server = Server.new(stream)
|
65
65
|
|
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.50.
|
4
|
+
version: 0.50.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: '1.28'
|
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.28'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: async-pool
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.12.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: bake-bundler
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
96
|
+
version: 0.12.0
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: async-rspec
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +137,7 @@ dependencies:
|
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
140
|
+
name: covered
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - ">="
|
@@ -165,7 +151,7 @@ dependencies:
|
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
154
|
+
name: bundler
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
157
|
- - ">="
|
@@ -179,7 +165,7 @@ dependencies:
|
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '0'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
|
-
name: bundler
|
168
|
+
name: bake-bundler
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
184
170
|
requirements:
|
185
171
|
- - ">="
|