tipi 0.50 → 0.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +12 -8
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -6
- data/Gemfile.lock +13 -33
- data/df/server_utils.rb +3 -3
- data/examples/source.rb +5 -0
- data/examples/streaming.rb +10 -0
- data/examples/zlib-bench.rb +25 -0
- data/lib/tipi/controller/web_polyphony.rb +6 -6
- data/lib/tipi/http1_adapter.rb +9 -4
- data/lib/tipi/version.rb +1 -1
- data/test/helper.rb +10 -10
- data/tipi.gemspec +9 -6
- metadata +22 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6338c894cec0a59a270a7c75535441ab6be2c8a6fbb5457b8ecfd200ade25b92
|
4
|
+
data.tar.gz: 620303ca676af631574e678ca8e43f3af679d6c2dddbaeb29b1a1e3c3f3fe716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc80e081f7f933ab2f2f352aae042e0cd396942b460c2061a6064b2ba90c31011c8e8632a3abebc17c8904b7406164b9771d2a0645b868a6de0d79b0a296c67
|
7
|
+
data.tar.gz: 295b6f82fc7a1bbc4e5b15e8c49732aa05d66b0b366ad93aa310c17b7be727a71f179f68358e5905d06efa29ad0b2f8a95d948f7625ea9455dac74b1b32f023e
|
data/.github/workflows/test.yml
CHANGED
@@ -7,22 +7,26 @@ jobs:
|
|
7
7
|
strategy:
|
8
8
|
fail-fast: false
|
9
9
|
matrix:
|
10
|
-
os: [ubuntu-latest]
|
11
|
-
ruby: [2.
|
10
|
+
os: [ubuntu-latest, macos-latest]
|
11
|
+
ruby: ['2.7', '3.0', '3.1', 'head']
|
12
12
|
|
13
13
|
name: >-
|
14
14
|
${{matrix.os}}, ${{matrix.ruby}}
|
15
15
|
|
16
16
|
runs-on: ${{matrix.os}}
|
17
|
+
|
18
|
+
env:
|
19
|
+
POLYPHONY_USE_LIBEV: "1"
|
20
|
+
|
17
21
|
steps:
|
18
|
-
-
|
19
|
-
|
22
|
+
- name: Setup machine
|
23
|
+
uses: actions/checkout@v1
|
24
|
+
- name: Setup Ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
20
26
|
with:
|
21
27
|
ruby-version: ${{matrix.ruby}}
|
22
|
-
|
23
|
-
|
24
|
-
gem install bundler
|
25
|
-
POLYPHONY_USE_LIBEV=1 bundle install
|
28
|
+
bundler-cache: true # 'bundle install' and cache
|
29
|
+
cache-version: 2
|
26
30
|
- name: Show Linux kernel version
|
27
31
|
run: uname -r
|
28
32
|
- name: Run tests
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,37 +1,16 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../ever
|
3
|
-
specs:
|
4
|
-
ever (0.1)
|
5
|
-
|
6
|
-
PATH
|
7
|
-
remote: ../h1p
|
8
|
-
specs:
|
9
|
-
h1p (0.3)
|
10
|
-
|
11
|
-
PATH
|
12
|
-
remote: ../polyphony
|
13
|
-
specs:
|
14
|
-
polyphony (0.77)
|
15
|
-
|
16
|
-
PATH
|
17
|
-
remote: ../qeweney
|
18
|
-
specs:
|
19
|
-
qeweney (0.17)
|
20
|
-
escape_utils (~> 1.2.1)
|
21
|
-
|
22
1
|
PATH
|
23
2
|
remote: .
|
24
3
|
specs:
|
25
|
-
tipi (0.
|
4
|
+
tipi (0.51)
|
26
5
|
acme-client (~> 2.0.9)
|
27
6
|
ever (~> 0.1)
|
28
|
-
extralite (~> 1.
|
29
|
-
h1p (~> 0.
|
7
|
+
extralite (~> 1.14)
|
8
|
+
h1p (~> 0.4)
|
30
9
|
http-2 (~> 0.11)
|
31
10
|
localhost (~> 1.1.4)
|
32
11
|
msgpack (~> 1.4.2)
|
33
|
-
polyphony (~> 0.
|
34
|
-
qeweney (~> 0.
|
12
|
+
polyphony (~> 0.80)
|
13
|
+
qeweney (~> 0.18)
|
35
14
|
rack (>= 2.0.8, < 2.3.0)
|
36
15
|
websocket (~> 1.2.8)
|
37
16
|
|
@@ -44,8 +23,9 @@ GEM
|
|
44
23
|
rack (>= 1.6.0)
|
45
24
|
docile (1.4.0)
|
46
25
|
escape_utils (1.2.1)
|
47
|
-
|
48
|
-
|
26
|
+
ever (0.1)
|
27
|
+
extralite (1.14)
|
28
|
+
faraday (1.10.0)
|
49
29
|
faraday-em_http (~> 1.0)
|
50
30
|
faraday-em_synchrony (~> 1.0)
|
51
31
|
faraday-excon (~> 1.1)
|
@@ -68,13 +48,17 @@ GEM
|
|
68
48
|
faraday-patron (1.0.0)
|
69
49
|
faraday-rack (1.0.0)
|
70
50
|
faraday-retry (1.0.3)
|
51
|
+
h1p (0.4)
|
71
52
|
http-2 (0.11.0)
|
72
53
|
json (2.6.1)
|
73
54
|
localhost (1.1.9)
|
74
55
|
memory_profiler (1.0.0)
|
75
56
|
minitest (5.11.3)
|
76
|
-
msgpack (1.4.
|
57
|
+
msgpack (1.4.5)
|
77
58
|
multipart-post (2.1.1)
|
59
|
+
polyphony (0.80)
|
60
|
+
qeweney (0.18)
|
61
|
+
escape_utils (~> 1.2.1)
|
78
62
|
rack (2.2.3)
|
79
63
|
rake (13.0.6)
|
80
64
|
ruby2_keywords (0.0.5)
|
@@ -90,12 +74,8 @@ PLATFORMS
|
|
90
74
|
|
91
75
|
DEPENDENCIES
|
92
76
|
cuba (~> 3.9.3)
|
93
|
-
ever!
|
94
|
-
h1p!
|
95
77
|
memory_profiler (~> 1.0.0)
|
96
78
|
minitest (~> 5.11.3)
|
97
|
-
polyphony!
|
98
|
-
qeweney!
|
99
79
|
rake (~> 13.0.6)
|
100
80
|
simplecov (~> 0.17.1)
|
101
81
|
tipi!
|
data/df/server_utils.rb
CHANGED
@@ -162,11 +162,11 @@ if ENV['TRACE'] == '1'
|
|
162
162
|
Thread.backend.trace_proc = proc do |event, fiber, value, pri|
|
163
163
|
fiber_id = fiber.tag || fiber.inspect
|
164
164
|
case event
|
165
|
-
when :
|
165
|
+
when :schedule
|
166
166
|
log format("=> %s %s %s %s", event, fiber_id, value.inspect, pri ? '(priority)' : '')
|
167
|
-
when :
|
167
|
+
when :unblock
|
168
168
|
log format("=> %s %s %s", event, fiber_id, value.inspect)
|
169
|
-
when :
|
169
|
+
when :spin, :terminate
|
170
170
|
log format("=> %s %s", event, fiber_id)
|
171
171
|
else
|
172
172
|
log format("=> %s", event)
|
data/examples/source.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FILE_SIZES = {
|
4
|
+
's.tmp' => 2**10,
|
5
|
+
'm.tmp' => 2**17,
|
6
|
+
'l.tmp' => 2**20,
|
7
|
+
'xl.tmp' => 2**24
|
8
|
+
}
|
9
|
+
|
10
|
+
def create_files
|
11
|
+
FILE_SIZES.each { |fn, size|
|
12
|
+
IO.write(File.join('/tmp', fn), '*' * size)
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
create_files
|
17
|
+
|
18
|
+
run { |req|
|
19
|
+
file_path = File.join('/tmp', req.path)
|
20
|
+
if File.file?(file_path)
|
21
|
+
req.serve_file(file_path)
|
22
|
+
else
|
23
|
+
req.respond(nil, ':status' => 404)
|
24
|
+
end
|
25
|
+
}
|
@@ -24,9 +24,9 @@ module Tipi
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def supervise_workers(worker_count)
|
27
|
-
supervisor = spin do
|
27
|
+
supervisor = spin(:web_worker_supervisor) do
|
28
28
|
worker_count.times do
|
29
|
-
spin do
|
29
|
+
spin(:web_worker) do
|
30
30
|
pid = Polyphony.fork { run_worker }
|
31
31
|
puts "Forked worker pid: #{pid}"
|
32
32
|
Polyphony.backend_waitpid(pid)
|
@@ -251,7 +251,7 @@ module Tipi
|
|
251
251
|
}.freeze
|
252
252
|
|
253
253
|
def spin_accept_loop(name, port, &block)
|
254
|
-
spin do
|
254
|
+
spin(:accept_loop) do
|
255
255
|
server = Polyphony::Net.tcp_listen('0.0.0.0', port, SOCKET_OPTS)
|
256
256
|
loop do
|
257
257
|
socket = server.accept
|
@@ -267,7 +267,7 @@ module Tipi
|
|
267
267
|
end
|
268
268
|
|
269
269
|
def spin_connection_handler(name, socket, block)
|
270
|
-
spin do
|
270
|
+
spin(:connection_handler) do
|
271
271
|
block.(socket)
|
272
272
|
rescue Polyphony::BaseException
|
273
273
|
raise
|
@@ -288,7 +288,7 @@ module Tipi
|
|
288
288
|
end
|
289
289
|
|
290
290
|
def gracefully_terminate_conections(fiber)
|
291
|
-
supervisor = spin { supervise }.detach
|
291
|
+
supervisor = spin(:connection_termination_supervisor) { supervise }.detach
|
292
292
|
fiber.attach_all_children_to(supervisor)
|
293
293
|
|
294
294
|
# terminating the supervisor will
|
@@ -344,7 +344,7 @@ module Tipi
|
|
344
344
|
end
|
345
345
|
|
346
346
|
def start_server(service)
|
347
|
-
spin do
|
347
|
+
spin(:web_server) do
|
348
348
|
service.call
|
349
349
|
supervise(restart: :always)
|
350
350
|
end
|
data/lib/tipi/http1_adapter.rb
CHANGED
@@ -220,10 +220,15 @@ module Tipi
|
|
220
220
|
# @param done [boolean] whether the response is completed
|
221
221
|
# @return [void]
|
222
222
|
def send_chunk(request, chunk, done: false)
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
223
|
+
if done
|
224
|
+
data = chunk ?
|
225
|
+
"#{chunk.bytesize.to_s(16)}\r\n#{chunk}\r\n0\r\n\r\n" :
|
226
|
+
"0\r\n\r\n"
|
227
|
+
elsif chunk
|
228
|
+
data = "#{chunk.bytesize.to_s(16)}\r\n#{chunk}\r\n"
|
229
|
+
else
|
230
|
+
return
|
231
|
+
end
|
227
232
|
|
228
233
|
request.tx_incr(data.bytesize)
|
229
234
|
@conn.write(data)
|
data/lib/tipi/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -76,16 +76,16 @@ class IO
|
|
76
76
|
|
77
77
|
def self.mockup_connection(input, output, output2)
|
78
78
|
eg(
|
79
|
-
|
80
|
-
read:
|
81
|
-
read_loop:
|
82
|
-
recv_loop:
|
83
|
-
readpartial:
|
84
|
-
recv:
|
85
|
-
'<<':
|
86
|
-
write:
|
87
|
-
close:
|
88
|
-
eof?:
|
79
|
+
__read_method__: -> { :readpartial },
|
80
|
+
read: ->(*args) { input.read(*args) },
|
81
|
+
read_loop: ->(*args, &block) { input.read_loop(*args, &block) },
|
82
|
+
recv_loop: ->(*args, &block) { input.read_loop(*args, &block) },
|
83
|
+
readpartial: ->(*args) { input.readpartial(*args) },
|
84
|
+
recv: ->(*args) { input.readpartial(*args) },
|
85
|
+
'<<': ->(*args) { output.write(*args) },
|
86
|
+
write: ->(*args) { output.write(*args) },
|
87
|
+
close: -> { output.close },
|
88
|
+
eof?: -> { output2.closed? }
|
89
89
|
)
|
90
90
|
end
|
91
91
|
end
|
data/tipi.gemspec
CHANGED
@@ -10,20 +10,23 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.files = `git ls-files`.split
|
11
11
|
s.homepage = 'http://github.com/digital-fabric/tipi'
|
12
12
|
s.metadata = {
|
13
|
-
"source_code_uri" => "https://github.com/digital-fabric/tipi"
|
13
|
+
"source_code_uri" => "https://github.com/digital-fabric/tipi",
|
14
|
+
"documentation_uri" => "https://www.rubydoc.info/gems/tipi",
|
15
|
+
"homepage_uri" => "https://github.com/digital-fabric/tipi",
|
16
|
+
"changelog_uri" => "https://github.com/digital-fabric/tipi/blob/master/CHANGELOG.md"
|
14
17
|
}
|
15
18
|
s.rdoc_options = ["--title", "tipi", "--main", "README.md"]
|
16
19
|
s.extra_rdoc_files = ["README.md"]
|
17
20
|
s.require_paths = ["lib"]
|
18
|
-
s.required_ruby_version = '>= 2.
|
21
|
+
s.required_ruby_version = '>= 2.7'
|
19
22
|
|
20
23
|
s.executables = ['tipi']
|
21
24
|
|
22
|
-
s.add_runtime_dependency 'polyphony', '~>0.
|
25
|
+
s.add_runtime_dependency 'polyphony', '~>0.80'
|
23
26
|
s.add_runtime_dependency 'ever', '~>0.1'
|
24
|
-
s.add_runtime_dependency 'qeweney', '~>0.
|
25
|
-
s.add_runtime_dependency 'extralite', '~>1.
|
26
|
-
s.add_runtime_dependency 'h1p', '~>0.
|
27
|
+
s.add_runtime_dependency 'qeweney', '~>0.18'
|
28
|
+
s.add_runtime_dependency 'extralite', '~>1.14'
|
29
|
+
s.add_runtime_dependency 'h1p', '~>0.4'
|
27
30
|
|
28
31
|
s.add_runtime_dependency 'http-2', '~>0.11'
|
29
32
|
s.add_runtime_dependency 'rack', '>=2.0.8', '<2.3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tipi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.51'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: polyphony
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.80'
|
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.
|
26
|
+
version: '0.80'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ever
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,42 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.18'
|
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.
|
54
|
+
version: '0.18'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: extralite
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.14'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.14'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: h1p
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: http-2
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,7 +240,7 @@ dependencies:
|
|
240
240
|
- - "~>"
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: 3.9.3
|
243
|
-
description:
|
243
|
+
description:
|
244
244
|
email: sharon@noteflakes.com
|
245
245
|
executables:
|
246
246
|
- tipi
|
@@ -305,12 +305,15 @@ files:
|
|
305
305
|
- examples/rack_server_https_forked.rb
|
306
306
|
- examples/routing_server.rb
|
307
307
|
- examples/servername_cb.rb
|
308
|
+
- examples/source.rb
|
309
|
+
- examples/streaming.rb
|
308
310
|
- examples/websocket_client.rb
|
309
311
|
- examples/websocket_demo.rb
|
310
312
|
- examples/websocket_secure_server.rb
|
311
313
|
- examples/websocket_server.rb
|
312
314
|
- examples/ws_page.html
|
313
315
|
- examples/wss_page.html
|
316
|
+
- examples/zlib-bench.rb
|
314
317
|
- lib/tipi.rb
|
315
318
|
- lib/tipi/acme.rb
|
316
319
|
- lib/tipi/cli.rb
|
@@ -352,7 +355,10 @@ licenses:
|
|
352
355
|
- MIT
|
353
356
|
metadata:
|
354
357
|
source_code_uri: https://github.com/digital-fabric/tipi
|
355
|
-
|
358
|
+
documentation_uri: https://www.rubydoc.info/gems/tipi
|
359
|
+
homepage_uri: https://github.com/digital-fabric/tipi
|
360
|
+
changelog_uri: https://github.com/digital-fabric/tipi/blob/master/CHANGELOG.md
|
361
|
+
post_install_message:
|
356
362
|
rdoc_options:
|
357
363
|
- "--title"
|
358
364
|
- tipi
|
@@ -364,15 +370,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
364
370
|
requirements:
|
365
371
|
- - ">="
|
366
372
|
- !ruby/object:Gem::Version
|
367
|
-
version: '2.
|
373
|
+
version: '2.7'
|
368
374
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
369
375
|
requirements:
|
370
376
|
- - ">="
|
371
377
|
- !ruby/object:Gem::Version
|
372
378
|
version: '0'
|
373
379
|
requirements: []
|
374
|
-
rubygems_version: 3.
|
375
|
-
signing_key:
|
380
|
+
rubygems_version: 3.1.6
|
381
|
+
signing_key:
|
376
382
|
specification_version: 4
|
377
383
|
summary: Tipi - the All-in-one Web Server for Ruby Apps
|
378
384
|
test_files: []
|