async-http 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +3 -3
- data/async-http.gemspec +1 -3
- data/lib/async/http/client.rb +5 -5
- data/lib/async/http/server.rb +6 -6
- data/lib/async/http/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f9b73efd52b9aff0ce5694485bdb8aac7cf1082
|
4
|
+
data.tar.gz: f0634e36cc4197cec96f31cfd61e6b381ecf66bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa06d63bf498e81afb71e35d20d2b3b9a7176a1f1ceaf2237bd6ad0172104b76fac30529ad1946c32504bb024ba86e88fa10e90f7b6edd01d391dbf305f47f9b
|
7
|
+
data.tar.gz: 7d46145caa8a5460d6920103272569b82d415a9e570ed5c755b79c2fc00ecfd1c9ceb25b16f7fc6cbb4aa00422a61d136c4729ea2afa8414595e84b464f2d6dd
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ task :server do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
server = Async::HTTP::Server.new([
|
17
|
-
Async::IO::
|
17
|
+
Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true)
|
18
18
|
], app)
|
19
19
|
|
20
20
|
Async::Reactor.run do
|
@@ -27,7 +27,7 @@ task :client do
|
|
27
27
|
require 'async/http/client'
|
28
28
|
|
29
29
|
client = Async::HTTP::Client.new([
|
30
|
-
Async::IO::
|
30
|
+
Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true)
|
31
31
|
])
|
32
32
|
|
33
33
|
Async::Reactor.run do
|
@@ -46,7 +46,7 @@ task :wrk do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
server = Async::HTTP::Server.new([
|
49
|
-
Async::IO::
|
49
|
+
Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true)
|
50
50
|
], app)
|
51
51
|
|
52
52
|
process_count = Etc.nprocessors
|
data/async-http.gemspec
CHANGED
@@ -16,9 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency("async-io", "~> 0
|
20
|
-
|
21
|
-
spec.add_dependency('samovar', "~> 1.3")
|
19
|
+
spec.add_dependency("async-io", "~> 1.0")
|
22
20
|
|
23
21
|
spec.add_development_dependency "async-rspec", "~> 1.1"
|
24
22
|
|
data/lib/async/http/client.rb
CHANGED
@@ -18,15 +18,15 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require 'async/io/
|
21
|
+
require 'async/io/endpoint'
|
22
22
|
|
23
23
|
require_relative 'protocol'
|
24
24
|
|
25
25
|
module Async
|
26
26
|
module HTTP
|
27
27
|
class Client
|
28
|
-
def initialize(
|
29
|
-
@
|
28
|
+
def initialize(endpoints, protocol_class = Protocol::HTTP11)
|
29
|
+
@endpoints = endpoints
|
30
30
|
|
31
31
|
@protocol_class = protocol_class
|
32
32
|
end
|
@@ -42,10 +42,10 @@ module Async
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def connect
|
45
|
-
Async::IO::
|
45
|
+
Async::IO::Endpoint.each(@endpoints) do |endpoint|
|
46
46
|
# puts "Connecting to #{address} on process #{Process.pid}"
|
47
47
|
|
48
|
-
|
48
|
+
endpoint.connect do |peer|
|
49
49
|
stream = Async::IO::Stream.new(peer)
|
50
50
|
|
51
51
|
# We only yield for first successful connection.
|
data/lib/async/http/server.rb
CHANGED
@@ -18,15 +18,15 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require 'async/io/
|
21
|
+
require 'async/io/endpoint'
|
22
22
|
|
23
23
|
require_relative 'protocol'
|
24
24
|
|
25
25
|
module Async
|
26
26
|
module HTTP
|
27
27
|
class Server
|
28
|
-
def initialize(
|
29
|
-
@
|
28
|
+
def initialize(endpoints, protocol_class = Protocol::HTTP1x)
|
29
|
+
@endpoints = endpoints
|
30
30
|
@protocol_class = protocol_class
|
31
31
|
end
|
32
32
|
|
@@ -59,10 +59,10 @@ module Async
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def run
|
62
|
-
Async::IO::
|
63
|
-
# puts "Binding to #{
|
62
|
+
Async::IO::Endpoint.each(@endpoints) do |endpoint|
|
63
|
+
# puts "Binding to #{endpoint} on process #{Process.pid}"
|
64
64
|
|
65
|
-
|
65
|
+
endpoint.accept(&self.method(:accept))
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-io
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: samovar
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.3'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.3'
|
26
|
+
version: '1.0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: async-rspec
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
124
|
version: '0'
|
139
125
|
requirements: []
|
140
126
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.6.
|
127
|
+
rubygems_version: 2.6.12
|
142
128
|
signing_key:
|
143
129
|
specification_version: 4
|
144
130
|
summary: ''
|