polyphony-http 0.26 → 0.27
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 +4 -4
- data/.github/workflows/test.yml +18 -0
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +6 -7
- data/lib/polyphony/http/server.rb +51 -46
- data/lib/polyphony/http/server/http1.rb +264 -261
- data/lib/polyphony/http/server/http2.rb +64 -61
- data/lib/polyphony/http/server/http2_stream.rb +132 -129
- data/lib/polyphony/http/server/request.rb +116 -112
- data/lib/polyphony/http/version.rb +1 -1
- data/polyphony-http.gemspec +2 -2
- data/test/test_http_server.rb +10 -10
- metadata +19 -19
- data/lib/polyphony/http.rb +0 -16
data/polyphony-http.gemspec
CHANGED
@@ -19,14 +19,14 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.executables = ['poly']
|
21
21
|
|
22
|
-
s.add_runtime_dependency '
|
23
|
-
s.add_runtime_dependency 'polyphony', '~>0.32'
|
22
|
+
s.add_runtime_dependency 'polyphony', '~>0.38'
|
24
23
|
|
25
24
|
s.add_runtime_dependency 'http_parser.rb', '~>0.6.0'
|
26
25
|
s.add_runtime_dependency 'http-2', '~>0.10.0'
|
27
26
|
s.add_runtime_dependency 'rack', '~>2.0.8'
|
28
27
|
s.add_runtime_dependency 'websocket', '~>1.2.8'
|
29
28
|
|
29
|
+
s.add_development_dependency 'rake', '~>12.3.3'
|
30
30
|
s.add_development_dependency 'localhost', '~>1.1.4'
|
31
31
|
s.add_development_dependency 'minitest', '~>5.11.3'
|
32
32
|
s.add_development_dependency 'minitest-reporters', '~>1.4.2'
|
data/test/test_http_server.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'helper'
|
4
|
-
require 'polyphony/http'
|
4
|
+
require 'polyphony/http/server'
|
5
5
|
|
6
6
|
class String
|
7
7
|
def http_lines
|
@@ -169,18 +169,18 @@ class HTTP1ServerTest < MiniTest::Test
|
|
169
169
|
6
|
170
170
|
foobar
|
171
171
|
HTTP
|
172
|
-
|
172
|
+
20.times { snooze }
|
173
173
|
assert request
|
174
174
|
assert_equal %w[foobar], chunks
|
175
175
|
assert !request.complete?
|
176
176
|
|
177
177
|
connection << "6\r\nbazbud\r\n"
|
178
|
-
snooze
|
178
|
+
20.times { snooze }
|
179
179
|
assert_equal %w[foobar bazbud], chunks
|
180
180
|
assert !request.complete?
|
181
181
|
|
182
182
|
connection << "0\r\n\r\n"
|
183
|
-
snooze
|
183
|
+
20.times { snooze }
|
184
184
|
assert_equal %w[foobar bazbud], chunks
|
185
185
|
assert request.complete?
|
186
186
|
|
@@ -270,17 +270,17 @@ class HTTP1ServerTest < MiniTest::Test
|
|
270
270
|
|
271
271
|
connection.close
|
272
272
|
assert !done
|
273
|
-
snooze
|
273
|
+
10.times { snooze }
|
274
274
|
assert done
|
275
275
|
end
|
276
276
|
|
277
277
|
def test_big_download
|
278
|
-
chunk_size =
|
279
|
-
chunk_count =
|
278
|
+
chunk_size = 10000
|
279
|
+
chunk_count = 1000
|
280
280
|
chunk = '*' * chunk_size
|
281
281
|
@server, connection = spin_server do |req|
|
282
282
|
req.send_headers
|
283
|
-
chunk_count.times do
|
283
|
+
chunk_count.times do |i|
|
284
284
|
req << chunk
|
285
285
|
snooze
|
286
286
|
end
|
@@ -292,7 +292,7 @@ class HTTP1ServerTest < MiniTest::Test
|
|
292
292
|
count = 0
|
293
293
|
|
294
294
|
connection << "GET / HTTP/1.1\r\n\r\n"
|
295
|
-
while (data = connection.readpartial(chunk_size
|
295
|
+
while (data = connection.readpartial(chunk_size))
|
296
296
|
response << data
|
297
297
|
count += 1
|
298
298
|
snooze
|
@@ -308,6 +308,6 @@ class HTTP1ServerTest < MiniTest::Test
|
|
308
308
|
HTTP
|
309
309
|
|
310
310
|
assert_equal expected, response
|
311
|
-
|
311
|
+
assert count >= chunk_count
|
312
312
|
end
|
313
313
|
end
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyphony-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.27'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: modulation
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: polyphony
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
19
|
+
version: '0.38'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
26
|
+
version: '0.38'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: http_parser.rb
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +80,20 @@ dependencies:
|
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: 1.2.8
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 12.3.3
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 12.3.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: localhost
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,6 +158,7 @@ extensions: []
|
|
158
158
|
extra_rdoc_files:
|
159
159
|
- README.md
|
160
160
|
files:
|
161
|
+
- ".github/workflows/test.yml"
|
161
162
|
- ".gitignore"
|
162
163
|
- CHANGELOG.md
|
163
164
|
- Gemfile
|
@@ -194,7 +195,6 @@ files:
|
|
194
195
|
- examples/websocket_server.rb
|
195
196
|
- examples/ws_page.html
|
196
197
|
- examples/wss_page.html
|
197
|
-
- lib/polyphony/http.rb
|
198
198
|
- lib/polyphony/http/client/agent.rb
|
199
199
|
- lib/polyphony/http/client/http1.rb
|
200
200
|
- lib/polyphony/http/client/http2.rb
|
data/lib/polyphony/http.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'polyphony'
|
4
|
-
|
5
|
-
module Polyphony
|
6
|
-
# HTTP imports (loaded dynamically)
|
7
|
-
module HTTP
|
8
|
-
auto_import(
|
9
|
-
Agent: './http/client/agent',
|
10
|
-
Rack: './http/server/rack',
|
11
|
-
Server: './http/server'
|
12
|
-
)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
export_default Polyphony::HTTP
|