tipi 0.32 → 0.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/Gemfile.lock +10 -4
- data/LICENSE +1 -1
- data/TODO.md +13 -47
- data/bin/tipi +13 -0
- data/df/agent.rb +63 -0
- data/df/etc_benchmark.rb +15 -0
- data/df/multi_agent_supervisor.rb +87 -0
- data/df/multi_client.rb +84 -0
- data/df/routing_benchmark.rb +60 -0
- data/df/sample_agent.rb +89 -0
- data/df/server.rb +54 -0
- data/df/sse_page.html +29 -0
- data/df/stress.rb +24 -0
- data/df/ws_page.html +38 -0
- data/e +0 -0
- data/examples/http_request_ws_server.rb +35 -0
- data/examples/http_server.rb +6 -6
- data/examples/http_server_forked.rb +4 -5
- data/examples/http_server_form.rb +23 -0
- data/examples/http_server_throttled_accept.rb +23 -0
- data/examples/http_unix_socket_server.rb +17 -0
- data/examples/http_ws_server.rb +10 -12
- data/examples/routing_server.rb +34 -0
- data/examples/ws_page.html +1 -2
- data/lib/tipi.rb +7 -5
- data/lib/tipi/configuration.rb +1 -1
- data/lib/tipi/digital_fabric.rb +7 -0
- data/lib/tipi/digital_fabric/agent.rb +225 -0
- data/lib/tipi/digital_fabric/agent_proxy.rb +265 -0
- data/lib/tipi/digital_fabric/executive.rb +100 -0
- data/lib/tipi/digital_fabric/executive/index.html +69 -0
- data/lib/tipi/digital_fabric/protocol.rb +90 -0
- data/lib/tipi/digital_fabric/request_adapter.rb +48 -0
- data/lib/tipi/digital_fabric/service.rb +230 -0
- data/lib/tipi/http1_adapter.rb +50 -16
- data/lib/tipi/http2_adapter.rb +5 -3
- data/lib/tipi/http2_stream.rb +19 -7
- data/lib/tipi/rack_adapter.rb +11 -3
- data/lib/tipi/version.rb +1 -1
- data/lib/tipi/websocket.rb +33 -29
- data/test/helper.rb +1 -2
- data/test/test_http_server.rb +3 -2
- data/test/test_request.rb +108 -0
- data/tipi.gemspec +7 -3
- metadata +59 -7
- data/lib/tipi/request.rb +0 -118
data/tipi.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.licenses = ['MIT']
|
7
7
|
s.summary = 'Tipi - the All-in-one Web Server for Ruby Apps'
|
8
8
|
s.author = 'Sharon Rosner'
|
9
|
-
s.email = '
|
9
|
+
s.email = 'sharon@noteflakes.com'
|
10
10
|
s.files = `git ls-files`.split
|
11
11
|
s.homepage = 'http://github.com/digital-fabric/tipi'
|
12
12
|
s.metadata = {
|
@@ -19,13 +19,17 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.executables = ['tipi']
|
21
21
|
|
22
|
-
s.add_runtime_dependency 'polyphony', '~>0.
|
22
|
+
s.add_runtime_dependency 'polyphony', '~>0.51.0'
|
23
|
+
s.add_runtime_dependency 'qeweney', '~>0.5'
|
23
24
|
|
24
25
|
s.add_runtime_dependency 'http_parser.rb', '~>0.6.0'
|
25
26
|
s.add_runtime_dependency 'http-2', '~>0.10.0'
|
26
27
|
s.add_runtime_dependency 'rack', '>=2.0.8', '<2.3.0'
|
27
28
|
s.add_runtime_dependency 'websocket', '~>1.2.8'
|
28
|
-
|
29
|
+
|
30
|
+
# for digital fabric
|
31
|
+
s.add_runtime_dependency 'msgpack', '~>1.4.2'
|
32
|
+
|
29
33
|
s.add_development_dependency 'rake', '~>12.3.3'
|
30
34
|
s.add_development_dependency 'localhost', '~>1.1.4'
|
31
35
|
s.add_development_dependency 'minitest', '~>5.11.3'
|
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.37'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: polyphony
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.51.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:
|
26
|
+
version: 0.51.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: qeweney
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.5'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: http_parser.rb
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +100,20 @@ dependencies:
|
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: 1.2.8
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: msgpack
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.4.2
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 1.4.2
|
89
117
|
- !ruby/object:Gem::Dependency
|
90
118
|
name: rake
|
91
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,7 +185,7 @@ dependencies:
|
|
157
185
|
- !ruby/object:Gem::Version
|
158
186
|
version: 0.17.1
|
159
187
|
description:
|
160
|
-
email:
|
188
|
+
email: sharon@noteflakes.com
|
161
189
|
executables:
|
162
190
|
- tipi
|
163
191
|
extensions: []
|
@@ -174,18 +202,33 @@ files:
|
|
174
202
|
- Rakefile
|
175
203
|
- TODO.md
|
176
204
|
- bin/tipi
|
205
|
+
- df/agent.rb
|
206
|
+
- df/etc_benchmark.rb
|
207
|
+
- df/multi_agent_supervisor.rb
|
208
|
+
- df/multi_client.rb
|
209
|
+
- df/routing_benchmark.rb
|
210
|
+
- df/sample_agent.rb
|
211
|
+
- df/server.rb
|
212
|
+
- df/sse_page.html
|
213
|
+
- df/stress.rb
|
214
|
+
- df/ws_page.html
|
177
215
|
- docs/README.md
|
178
216
|
- docs/tipi-logo.png
|
217
|
+
- e
|
179
218
|
- examples/cuba.ru
|
180
219
|
- examples/hanami-api.ru
|
181
220
|
- examples/hello.ru
|
221
|
+
- examples/http_request_ws_server.rb
|
182
222
|
- examples/http_server.js
|
183
223
|
- examples/http_server.rb
|
184
224
|
- examples/http_server_forked.rb
|
225
|
+
- examples/http_server_form.rb
|
185
226
|
- examples/http_server_graceful.rb
|
186
227
|
- examples/http_server_simple.rb
|
187
228
|
- examples/http_server_throttled.rb
|
229
|
+
- examples/http_server_throttled_accept.rb
|
188
230
|
- examples/http_server_timeout.rb
|
231
|
+
- examples/http_unix_socket_server.rb
|
189
232
|
- examples/http_ws_server.rb
|
190
233
|
- examples/https_server.rb
|
191
234
|
- examples/https_server_forked.rb
|
@@ -193,6 +236,7 @@ files:
|
|
193
236
|
- examples/rack_server.rb
|
194
237
|
- examples/rack_server_https.rb
|
195
238
|
- examples/rack_server_https_forked.rb
|
239
|
+
- examples/routing_server.rb
|
196
240
|
- examples/websocket_client.rb
|
197
241
|
- examples/websocket_demo.rb
|
198
242
|
- examples/websocket_secure_server.rb
|
@@ -202,12 +246,19 @@ files:
|
|
202
246
|
- lib/tipi.rb
|
203
247
|
- lib/tipi/config_dsl.rb
|
204
248
|
- lib/tipi/configuration.rb
|
249
|
+
- lib/tipi/digital_fabric.rb
|
250
|
+
- lib/tipi/digital_fabric/agent.rb
|
251
|
+
- lib/tipi/digital_fabric/agent_proxy.rb
|
252
|
+
- lib/tipi/digital_fabric/executive.rb
|
253
|
+
- lib/tipi/digital_fabric/executive/index.html
|
254
|
+
- lib/tipi/digital_fabric/protocol.rb
|
255
|
+
- lib/tipi/digital_fabric/request_adapter.rb
|
256
|
+
- lib/tipi/digital_fabric/service.rb
|
205
257
|
- lib/tipi/handler.rb
|
206
258
|
- lib/tipi/http1_adapter.rb
|
207
259
|
- lib/tipi/http2_adapter.rb
|
208
260
|
- lib/tipi/http2_stream.rb
|
209
261
|
- lib/tipi/rack_adapter.rb
|
210
|
-
- lib/tipi/request.rb
|
211
262
|
- lib/tipi/version.rb
|
212
263
|
- lib/tipi/websocket.rb
|
213
264
|
- test/coverage.rb
|
@@ -215,6 +266,7 @@ files:
|
|
215
266
|
- test/helper.rb
|
216
267
|
- test/run.rb
|
217
268
|
- test/test_http_server.rb
|
269
|
+
- test/test_request.rb
|
218
270
|
- tipi.gemspec
|
219
271
|
homepage: http://github.com/digital-fabric/tipi
|
220
272
|
licenses:
|
@@ -240,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
292
|
- !ruby/object:Gem::Version
|
241
293
|
version: '0'
|
242
294
|
requirements: []
|
243
|
-
rubygems_version: 3.1.
|
295
|
+
rubygems_version: 3.1.4
|
244
296
|
signing_key:
|
245
297
|
specification_version: 4
|
246
298
|
summary: Tipi - the All-in-one Web Server for Ruby Apps
|
data/lib/tipi/request.rb
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
|
5
|
-
module Tipi
|
6
|
-
# HTTP request
|
7
|
-
class Request
|
8
|
-
attr_reader :headers, :adapter
|
9
|
-
attr_accessor :__next__
|
10
|
-
|
11
|
-
def initialize(headers, adapter)
|
12
|
-
@headers = headers
|
13
|
-
@adapter = adapter
|
14
|
-
end
|
15
|
-
|
16
|
-
def protocol
|
17
|
-
@protocol = @adapter.protocol
|
18
|
-
end
|
19
|
-
|
20
|
-
def method
|
21
|
-
@method ||= @headers[':method']
|
22
|
-
end
|
23
|
-
|
24
|
-
def scheme
|
25
|
-
@scheme ||= @headers[':scheme']
|
26
|
-
end
|
27
|
-
|
28
|
-
def uri
|
29
|
-
@uri ||= URI.parse(@headers[':path'] || '')
|
30
|
-
end
|
31
|
-
|
32
|
-
def path
|
33
|
-
@path ||= uri.path
|
34
|
-
end
|
35
|
-
|
36
|
-
def query_string
|
37
|
-
@query_string ||= uri.query
|
38
|
-
end
|
39
|
-
|
40
|
-
def query
|
41
|
-
return @query if @query
|
42
|
-
|
43
|
-
@query = (q = uri.query) ? split_query_string(q) : {}
|
44
|
-
end
|
45
|
-
|
46
|
-
def split_query_string(query)
|
47
|
-
query.split('&').each_with_object({}) do |kv, h|
|
48
|
-
k, v = kv.split('=')
|
49
|
-
h[k.to_sym] = URI.decode_www_form_component(v)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def buffer_body_chunk(chunk)
|
54
|
-
@buffered_body_chunks ||= []
|
55
|
-
@buffered_body_chunks << chunk
|
56
|
-
end
|
57
|
-
|
58
|
-
def each_chunk(&block)
|
59
|
-
if @buffered_body_chunks
|
60
|
-
@buffered_body_chunks.each(&block)
|
61
|
-
@buffered_body_chunks = nil
|
62
|
-
end
|
63
|
-
while !@message_complete && (chunk = @adapter.get_body_chunk)
|
64
|
-
yield chunk
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def complete!(keep_alive = nil)
|
69
|
-
@message_complete = true
|
70
|
-
@keep_alive = keep_alive
|
71
|
-
end
|
72
|
-
|
73
|
-
def complete?
|
74
|
-
@message_complete
|
75
|
-
end
|
76
|
-
|
77
|
-
def consume
|
78
|
-
@adapter.consume_request
|
79
|
-
end
|
80
|
-
|
81
|
-
def keep_alive?
|
82
|
-
@keep_alive
|
83
|
-
end
|
84
|
-
|
85
|
-
def read
|
86
|
-
buf = @buffered_body_chunks ? @buffered_body_chunks.join : +''
|
87
|
-
while (chunk = @adapter.get_body_chunk)
|
88
|
-
buf << chunk
|
89
|
-
end
|
90
|
-
buf
|
91
|
-
end
|
92
|
-
|
93
|
-
def respond(body, headers = {})
|
94
|
-
@adapter.respond(body, headers)
|
95
|
-
@headers_sent = true
|
96
|
-
end
|
97
|
-
|
98
|
-
def send_headers(headers = {}, empty_response = false)
|
99
|
-
return if @headers_sent
|
100
|
-
|
101
|
-
@headers_sent = true
|
102
|
-
@adapter.send_headers(headers, empty_response: empty_response)
|
103
|
-
end
|
104
|
-
|
105
|
-
def send_chunk(body, done: false)
|
106
|
-
send_headers({}) unless @headers_sent
|
107
|
-
|
108
|
-
@adapter.send_chunk(body, done: done)
|
109
|
-
end
|
110
|
-
alias_method :<<, :send_chunk
|
111
|
-
|
112
|
-
def finish
|
113
|
-
send_headers({}) unless @headers_sent
|
114
|
-
|
115
|
-
@adapter.finish
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|