async-http 0.37.10 → 0.37.11

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: 4580a8fa7e52098d4802b4545e6bf9c751f4b2355bbc6c526ccafd054cf722b3
4
- data.tar.gz: 24eefee5a18a5c24e80fc8c36457b2e74dcdbe69547c6781ffa13653a34e10b5
3
+ metadata.gz: 87e0a46072706fa11d787dbaa220ebbb59d3ac15dc0b374b2067884668ca0de1
4
+ data.tar.gz: f98272e3c8d0c03f53f502139772683b683133bae07f9e0ece6eba0fa8264cfb
5
5
  SHA512:
6
- metadata.gz: 0e3ec117d299fd45460e736b27c9af3b607aabf9b2057d11c3f18d525547308cb0b22965ecd9f97fef885bd3d1c44626012eeb2fe127b6b7d43f248145447600
7
- data.tar.gz: 76b16ae1efcbc1e3089ebd6e07d7f612dda1b0dfe89e93a851b8256356ab137709ea95c4e5653c53de20b9b7b1c015dbe25c8d715b5a9701f2f331ea91e84ca4
6
+ metadata.gz: e25c217ffb5939937df9d99dd75389d16d04ed6c9814a1f83c24fa02d8a730aa19ae2d96f95f6e2e78c1825c571358829076ac6838eff101388d6da3aa56b35b
7
+ data.tar.gz: 8b0fba109c712997fd7582cdff517438592f0ad800f5145ec361450626b92dd17b0c8386fe761d3c67024627d5f883e4a86d78c8acdee39885a966f3b8dd76d1
data/Rakefile CHANGED
@@ -5,100 +5,5 @@ RSpec::Core::RakeTask.new(:test)
5
5
 
6
6
  task :default => :test
7
7
 
8
- require 'async/http/protocol'
9
- require 'async/http/url_endpoint'
10
- require 'async/io/host_endpoint'
11
-
12
- PROTOCOL = Async::HTTP::Protocol::HTTP1
13
-
14
- task :debug do
15
- require 'async/logger'
16
-
17
- Async.logger.level = Logger::DEBUG
18
- end
19
-
20
- task :google do
21
- require 'async'
22
- require 'pry'
23
-
24
- Async.run do
25
- endpoint = Async::HTTP::URLEndpoint.parse("https://www.google.com")
26
- peer = endpoint.connect
27
- stream = Async::IO::Stream.new(peer)
28
-
29
- framer = ::HTTP::Protocol::HTTP2::Framer.new(stream)
30
- client = ::HTTP::Protocol::HTTP2::Client.new(framer)
31
-
32
- client.send_connection_preface
33
-
34
- stream = ::HTTP::Protocol::HTTP2::Stream.new(client)
35
-
36
- client.read_frame
37
- client.read_frame
38
-
39
- stream.send_headers(nil, [[':method', 'GET'], [':authority', 'www.google.com'], [':path', '/']], ::HTTP::Protocol::HTTP2::END_STREAM)
40
-
41
- binding.pry
42
- end
43
- end
44
-
45
- task :server do
46
- require 'async/reactor'
47
- require 'async/container/forked'
48
- require 'async/http/server'
49
-
50
- server = Async::HTTP::Server.for(Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true), PROTOCOL) do |request|
51
- return Async::HTTP::Response[200, {'content-type' => 'text/plain'}, ["Hello World"]]
52
- end
53
-
54
- container = Async::Container::Forked.new(concurrency: 1) do
55
- #GC.disable
56
-
57
- server.run
58
- end
59
-
60
- container.wait
61
- end
62
-
63
- task :benchmark do
64
- sh 'wrk -t 8 -c 8 -d 2 http://127.0.0.1:9294'
65
- end
66
-
67
- task :client do
68
- require 'async/reactor'
69
- require 'async/http/client'
70
-
71
- client = Async::HTTP::Client.new(Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true), PROTOCOL)
72
-
73
- Async::Reactor.run do
74
- response = client.get("/")
75
-
76
- puts response.inspect
77
-
78
- client.close
79
- end
80
- end
81
-
82
- task :wrk do
83
- require 'async/reactor'
84
- require 'async/http/server'
85
- require 'async/container/forked'
86
-
87
- server = Async::HTTP::Server.for(Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true), PROTOCOL) do |request|
88
- return Async::HTTP::Response[200, {'content-type' => 'text/plain'}, ["Hello World"]]
89
- end
90
-
91
- concurrency = 1
92
-
93
- container = Async::Container::Forked.new(concurrency: concurrency) do
94
- server.run
95
- end
96
-
97
- url = "http://127.0.0.1:9294/"
98
-
99
- 5.times do
100
- system("wrk", "-c", concurrency.to_s, "-d", "10", "-t", concurrency.to_s, url)
101
- end
102
-
103
- container.stop
104
- end
8
+ # Load all rake tasks:
9
+ import(*Dir.glob('tasks/**/*.rake'))
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency("async", "~> 1.14")
20
20
  spec.add_dependency("async-io", "~> 1.18")
21
21
 
22
- spec.add_dependency("http-protocol", "~> 0.10")
22
+ spec.add_dependency("http-protocol", "~> 0.11")
23
23
 
24
24
  # spec.add_dependency("openssl")
25
25
 
@@ -54,8 +54,6 @@ module Async
54
54
 
55
55
  # Enumerate all chunks until finished, then invoke `#close`.
56
56
  def each
57
- return to_enum unless block_given?
58
-
59
57
  while chunk = self.read
60
58
  yield chunk
61
59
  # chunk.clear
@@ -78,18 +78,6 @@ module Async
78
78
  @stream.close
79
79
  end
80
80
 
81
- def write_empty_body(body)
82
- super(body)
83
-
84
- body.close if body
85
- end
86
-
87
- def write_body_head(body)
88
- super(body)
89
-
90
- body.close if body
91
- end
92
-
93
81
  def read_chunked_body
94
82
  Body::Chunked.new(self)
95
83
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.37.10"
23
+ VERSION = "0.37.11"
24
24
  end
25
25
  end
@@ -0,0 +1,100 @@
1
+
2
+ task :http1 do
3
+ require 'async/http/protocol'
4
+ require 'async/http/url_endpoint'
5
+ require 'async/io/host_endpoint'
6
+
7
+ @protocol = Async::HTTP::Protocol::HTTP1
8
+ end
9
+
10
+ task :debug do
11
+ require 'async/logger'
12
+
13
+ Async.logger.level = Logger::DEBUG
14
+ end
15
+
16
+ task :google do
17
+ require 'async'
18
+ require 'pry'
19
+
20
+ Async.run do
21
+ endpoint = Async::HTTP::URLEndpoint.parse("https://www.google.com")
22
+ peer = endpoint.connect
23
+ stream = Async::IO::Stream.new(peer)
24
+
25
+ framer = ::HTTP::Protocol::HTTP2::Framer.new(stream)
26
+ client = ::HTTP::Protocol::HTTP2::Client.new(framer)
27
+
28
+ client.send_connection_preface
29
+
30
+ stream = ::HTTP::Protocol::HTTP2::Stream.new(client)
31
+
32
+ client.read_frame
33
+ client.read_frame
34
+
35
+ stream.send_headers(nil, [[':method', 'GET'], [':authority', 'www.google.com'], [':path', '/']], ::HTTP::Protocol::HTTP2::END_STREAM)
36
+
37
+ binding.pry
38
+ end
39
+ end
40
+
41
+ task :server do
42
+ require 'async/reactor'
43
+ require 'async/container/forked'
44
+ require 'async/http/server'
45
+
46
+ server = Async::HTTP::Server.for(Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true), @protocol) do |request|
47
+ return Async::HTTP::Response[200, {'content-type' => 'text/plain'}, ["Hello World"]]
48
+ end
49
+
50
+ container = Async::Container::Forked.new(concurrency: 1) do
51
+ #GC.disable
52
+
53
+ server.run
54
+ end
55
+
56
+ container.wait
57
+ end
58
+
59
+ task :benchmark do
60
+ sh 'wrk -t 8 -c 8 -d 2 http://127.0.0.1:9294'
61
+ end
62
+
63
+ task :client do
64
+ require 'async/reactor'
65
+ require 'async/http/client'
66
+
67
+ client = Async::HTTP::Client.new(Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true), @protocol)
68
+
69
+ Async::Reactor.run do
70
+ response = client.get("/")
71
+
72
+ puts response.inspect
73
+
74
+ client.close
75
+ end
76
+ end
77
+
78
+ task :wrk do
79
+ require 'async/reactor'
80
+ require 'async/http/server'
81
+ require 'async/container/forked'
82
+
83
+ server = Async::HTTP::Server.for(Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true), @protocol) do |request|
84
+ return Async::HTTP::Response[200, {'content-type' => 'text/plain'}, ["Hello World"]]
85
+ end
86
+
87
+ concurrency = 1
88
+
89
+ container = Async::Container::Forked.new(concurrency: concurrency) do
90
+ server.run
91
+ end
92
+
93
+ url = "http://127.0.0.1:9294/"
94
+
95
+ 5.times do
96
+ system("wrk", "-c", concurrency.to_s, "-d", "10", "-t", concurrency.to_s, url)
97
+ end
98
+
99
+ container.stop
100
+ end
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.37.10
4
+ version: 0.37.11
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-01-19 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.10'
47
+ version: '0.11'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.10'
54
+ version: '0.11'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: async-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +198,7 @@ files:
198
198
  - lib/async/http/statistics.rb
199
199
  - lib/async/http/url_endpoint.rb
200
200
  - lib/async/http/version.rb
201
+ - tasks/server.rake
201
202
  homepage: https://github.com/socketry/async-http
202
203
  licenses: []
203
204
  metadata: {}
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  - !ruby/object:Gem::Version
217
218
  version: '0'
218
219
  requirements: []
219
- rubygems_version: 3.0.1
220
+ rubygems_version: 3.0.2
220
221
  signing_key:
221
222
  specification_version: 4
222
223
  summary: A HTTP client and server library.