tipi 0.38 → 0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +5 -1
  3. data/.gitignore +5 -0
  4. data/CHANGELOG.md +34 -0
  5. data/Gemfile +5 -1
  6. data/Gemfile.lock +58 -16
  7. data/Rakefile +7 -3
  8. data/TODO.md +77 -1
  9. data/benchmarks/bm_http1_parser.rb +61 -0
  10. data/bin/benchmark +37 -0
  11. data/bin/h1pd +6 -0
  12. data/bin/tipi +3 -21
  13. data/df/sample_agent.rb +1 -1
  14. data/df/server.rb +16 -47
  15. data/df/server_utils.rb +178 -0
  16. data/examples/full_service.rb +13 -0
  17. data/examples/http1_parser.rb +55 -0
  18. data/examples/http_server.rb +15 -3
  19. data/examples/http_server_forked.rb +5 -1
  20. data/examples/http_server_routes.rb +29 -0
  21. data/examples/http_server_static.rb +26 -0
  22. data/examples/http_server_throttled.rb +3 -2
  23. data/examples/https_server.rb +6 -4
  24. data/examples/https_wss_server.rb +2 -1
  25. data/examples/rack_server.rb +5 -0
  26. data/examples/rack_server_https.rb +1 -1
  27. data/examples/rack_server_https_forked.rb +4 -3
  28. data/examples/routing_server.rb +5 -4
  29. data/examples/servername_cb.rb +37 -0
  30. data/examples/websocket_demo.rb +2 -8
  31. data/examples/ws_page.html +2 -2
  32. data/ext/tipi/extconf.rb +13 -0
  33. data/ext/tipi/http1_parser.c +823 -0
  34. data/ext/tipi/http1_parser.h +18 -0
  35. data/ext/tipi/tipi_ext.c +5 -0
  36. data/lib/tipi.rb +89 -1
  37. data/lib/tipi/acme.rb +308 -0
  38. data/lib/tipi/cli.rb +30 -0
  39. data/lib/tipi/digital_fabric/agent.rb +22 -17
  40. data/lib/tipi/digital_fabric/agent_proxy.rb +95 -40
  41. data/lib/tipi/digital_fabric/executive.rb +6 -2
  42. data/lib/tipi/digital_fabric/protocol.rb +87 -15
  43. data/lib/tipi/digital_fabric/request_adapter.rb +6 -10
  44. data/lib/tipi/digital_fabric/service.rb +77 -51
  45. data/lib/tipi/http1_adapter.rb +116 -117
  46. data/lib/tipi/http2_adapter.rb +56 -10
  47. data/lib/tipi/http2_stream.rb +106 -53
  48. data/lib/tipi/rack_adapter.rb +2 -53
  49. data/lib/tipi/response_extensions.rb +17 -0
  50. data/lib/tipi/version.rb +1 -1
  51. data/security/http1.rb +12 -0
  52. data/test/helper.rb +60 -11
  53. data/test/test_http1_parser.rb +586 -0
  54. data/test/test_http_server.rb +0 -27
  55. data/test/test_request.rb +1 -28
  56. data/tipi.gemspec +11 -5
  57. metadata +96 -22
  58. data/e +0 -0
@@ -9,33 +9,6 @@ class String
9
9
  end
10
10
  end
11
11
 
12
- class IO
13
- # Creates two mockup sockets for simulating server-client communication
14
- def self.server_client_mockup
15
- server_in, client_out = IO.pipe
16
- client_in, server_out = IO.pipe
17
-
18
- server_connection = mockup_connection(server_in, server_out, client_out)
19
- client_connection = mockup_connection(client_in, client_out, server_out)
20
-
21
- [server_connection, client_connection]
22
- end
23
-
24
- def self.mockup_connection(input, output, output2)
25
- eg(
26
- :read => ->(*args) { input.read(*args) },
27
- :read_loop => ->(*args, &block) { input.read_loop(*args, &block) },
28
- :recv_loop => ->(*args, &block) { input.read_loop(*args, &block) },
29
- :readpartial => ->(*args) { input.readpartial(*args) },
30
- :recv => ->(*args) { input.readpartial(*args) },
31
- :<< => ->(*args) { output.write(*args) },
32
- :write => ->(*args) { output.write(*args) },
33
- :close => -> { output.close },
34
- :eof? => -> { output2.closed? }
35
- )
36
- end
37
- end
38
-
39
12
  class HTTP1ServerTest < MiniTest::Test
40
13
  def teardown
41
14
  @server&.interrupt if @server&.alive?
data/test/test_request.rb CHANGED
@@ -9,33 +9,6 @@ class String
9
9
  end
10
10
  end
11
11
 
12
- class IO
13
- # Creates two mockup sockets for simulating server-client communication
14
- def self.server_client_mockup
15
- server_in, client_out = IO.pipe
16
- client_in, server_out = IO.pipe
17
-
18
- server_connection = mockup_connection(server_in, server_out, client_out)
19
- client_connection = mockup_connection(client_in, client_out, server_out)
20
-
21
- [server_connection, client_connection]
22
- end
23
-
24
- def self.mockup_connection(input, output, output2)
25
- eg(
26
- :read => ->(*args) { input.read(*args) },
27
- :read_loop => ->(*args, &block) { input.read_loop(*args, &block) },
28
- :recv_loop => ->(*args, &block) { input.read_loop(*args, &block) },
29
- :readpartial => ->(*args) { input.readpartial(*args) },
30
- :recv => ->(*args) { input.readpartial(*args) },
31
- :<< => ->(*args) { output.write(*args) },
32
- :write => ->(*args) { output.write(*args) },
33
- :close => -> { output.close },
34
- :eof? => -> { output2.closed? }
35
- )
36
- end
37
- end
38
-
39
12
  class RequestHeadersTest < MiniTest::Test
40
13
  def teardown
41
14
  @server&.interrupt if @server&.alive?
@@ -65,7 +38,7 @@ class RequestHeadersTest < MiniTest::Test
65
38
  assert_kind_of Qeweney::Request, req
66
39
  assert_equal 'blah.com', req.headers['host']
67
40
  assert_equal 'bar', req.headers['foo']
68
- assert_equal ['1', '3', '2'], req.headers['hi']
41
+ assert_equal ['1', '2', '3'], req.headers['hi']
69
42
  assert_equal 'get', req.headers[':method']
70
43
  assert_equal '/titi', req.headers[':path']
71
44
  end
data/tipi.gemspec CHANGED
@@ -14,25 +14,31 @@ Gem::Specification.new do |s|
14
14
  }
15
15
  s.rdoc_options = ["--title", "tipi", "--main", "README.md"]
16
16
  s.extra_rdoc_files = ["README.md"]
17
+ s.extensions = ["ext/tipi/extconf.rb"]
17
18
  s.require_paths = ["lib"]
18
19
  s.required_ruby_version = '>= 2.6'
19
20
 
20
21
  s.executables = ['tipi']
21
22
 
22
- s.add_runtime_dependency 'polyphony', '~>0.52.0'
23
- s.add_runtime_dependency 'qeweney', '~>0.6'
23
+ s.add_runtime_dependency 'polyphony', '~>0.69'
24
+ s.add_runtime_dependency 'qeweney', '~>0.14'
25
+ s.add_runtime_dependency 'extralite', '~>1.2'
24
26
 
25
- s.add_runtime_dependency 'http_parser.rb', '~>0.6.0'
26
- s.add_runtime_dependency 'http-2', '~>0.10.0'
27
+ s.add_runtime_dependency 'http-2', '~>0.11'
27
28
  s.add_runtime_dependency 'rack', '>=2.0.8', '<2.3.0'
28
29
  s.add_runtime_dependency 'websocket', '~>1.2.8'
30
+ s.add_runtime_dependency 'acme-client', '~>2.0.8'
31
+ s.add_runtime_dependency 'localhost', '~>1.1.4'
29
32
 
30
33
  # for digital fabric
31
34
  s.add_runtime_dependency 'msgpack', '~>1.4.2'
32
35
 
36
+ s.add_development_dependency 'rake-compiler', '1.1.1'
33
37
  s.add_development_dependency 'rake', '~>12.3.3'
34
- s.add_development_dependency 'localhost', '~>1.1.4'
35
38
  s.add_development_dependency 'minitest', '~>5.11.3'
36
39
  s.add_development_dependency 'minitest-reporters', '~>1.4.2'
37
40
  s.add_development_dependency 'simplecov', '~>0.17.1'
41
+
42
+ s.add_development_dependency 'cuba', '~>3.9.3'
43
+ s.add_development_dependency 'http_parser.rb', '0.7.0'
38
44
  end
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.38'
4
+ version: '0.42'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: polyphony
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.52.0
19
+ version: '0.69'
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.52.0
26
+ version: '0.69'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: qeweney
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0.14'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '0.14'
41
41
  - !ruby/object:Gem::Dependency
42
- name: http_parser.rb
42
+ name: extralite
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.0
47
+ version: '1.2'
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.6.0
54
+ version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: http-2
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.10.0
61
+ version: '0.11'
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: 0.10.0
68
+ version: '0.11'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,34 @@ dependencies:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: 1.2.8
103
+ - !ruby/object:Gem::Dependency
104
+ name: acme-client
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 2.0.8
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 2.0.8
117
+ - !ruby/object:Gem::Dependency
118
+ name: localhost
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 1.1.4
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 1.1.4
103
131
  - !ruby/object:Gem::Dependency
104
132
  name: msgpack
105
133
  requirement: !ruby/object:Gem::Requirement
@@ -115,33 +143,33 @@ dependencies:
115
143
  - !ruby/object:Gem::Version
116
144
  version: 1.4.2
117
145
  - !ruby/object:Gem::Dependency
118
- name: rake
146
+ name: rake-compiler
119
147
  requirement: !ruby/object:Gem::Requirement
120
148
  requirements:
121
- - - "~>"
149
+ - - '='
122
150
  - !ruby/object:Gem::Version
123
- version: 12.3.3
151
+ version: 1.1.1
124
152
  type: :development
125
153
  prerelease: false
126
154
  version_requirements: !ruby/object:Gem::Requirement
127
155
  requirements:
128
- - - "~>"
156
+ - - '='
129
157
  - !ruby/object:Gem::Version
130
- version: 12.3.3
158
+ version: 1.1.1
131
159
  - !ruby/object:Gem::Dependency
132
- name: localhost
160
+ name: rake
133
161
  requirement: !ruby/object:Gem::Requirement
134
162
  requirements:
135
163
  - - "~>"
136
164
  - !ruby/object:Gem::Version
137
- version: 1.1.4
165
+ version: 12.3.3
138
166
  type: :development
139
167
  prerelease: false
140
168
  version_requirements: !ruby/object:Gem::Requirement
141
169
  requirements:
142
170
  - - "~>"
143
171
  - !ruby/object:Gem::Version
144
- version: 1.1.4
172
+ version: 12.3.3
145
173
  - !ruby/object:Gem::Dependency
146
174
  name: minitest
147
175
  requirement: !ruby/object:Gem::Requirement
@@ -184,11 +212,40 @@ dependencies:
184
212
  - - "~>"
185
213
  - !ruby/object:Gem::Version
186
214
  version: 0.17.1
215
+ - !ruby/object:Gem::Dependency
216
+ name: cuba
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: 3.9.3
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: 3.9.3
229
+ - !ruby/object:Gem::Dependency
230
+ name: http_parser.rb
231
+ requirement: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - '='
234
+ - !ruby/object:Gem::Version
235
+ version: 0.7.0
236
+ type: :development
237
+ prerelease: false
238
+ version_requirements: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - '='
241
+ - !ruby/object:Gem::Version
242
+ version: 0.7.0
187
243
  description:
188
244
  email: sharon@noteflakes.com
189
245
  executables:
190
246
  - tipi
191
- extensions: []
247
+ extensions:
248
+ - ext/tipi/extconf.rb
192
249
  extra_rdoc_files:
193
250
  - README.md
194
251
  files:
@@ -201,6 +258,9 @@ files:
201
258
  - README.md
202
259
  - Rakefile
203
260
  - TODO.md
261
+ - benchmarks/bm_http1_parser.rb
262
+ - bin/benchmark
263
+ - bin/h1pd
204
264
  - bin/tipi
205
265
  - df/agent.rb
206
266
  - df/etc_benchmark.rb
@@ -209,22 +269,26 @@ files:
209
269
  - df/routing_benchmark.rb
210
270
  - df/sample_agent.rb
211
271
  - df/server.rb
272
+ - df/server_utils.rb
212
273
  - df/sse_page.html
213
274
  - df/stress.rb
214
275
  - df/ws_page.html
215
276
  - docs/README.md
216
277
  - docs/tipi-logo.png
217
- - e
218
278
  - examples/cuba.ru
279
+ - examples/full_service.rb
219
280
  - examples/hanami-api.ru
220
281
  - examples/hello.ru
282
+ - examples/http1_parser.rb
221
283
  - examples/http_request_ws_server.rb
222
284
  - examples/http_server.js
223
285
  - examples/http_server.rb
224
286
  - examples/http_server_forked.rb
225
287
  - examples/http_server_form.rb
226
288
  - examples/http_server_graceful.rb
289
+ - examples/http_server_routes.rb
227
290
  - examples/http_server_simple.rb
291
+ - examples/http_server_static.rb
228
292
  - examples/http_server_throttled.rb
229
293
  - examples/http_server_throttled_accept.rb
230
294
  - examples/http_server_timeout.rb
@@ -237,13 +301,20 @@ files:
237
301
  - examples/rack_server_https.rb
238
302
  - examples/rack_server_https_forked.rb
239
303
  - examples/routing_server.rb
304
+ - examples/servername_cb.rb
240
305
  - examples/websocket_client.rb
241
306
  - examples/websocket_demo.rb
242
307
  - examples/websocket_secure_server.rb
243
308
  - examples/websocket_server.rb
244
309
  - examples/ws_page.html
245
310
  - examples/wss_page.html
311
+ - ext/tipi/extconf.rb
312
+ - ext/tipi/http1_parser.c
313
+ - ext/tipi/http1_parser.h
314
+ - ext/tipi/tipi_ext.c
246
315
  - lib/tipi.rb
316
+ - lib/tipi/acme.rb
317
+ - lib/tipi/cli.rb
247
318
  - lib/tipi/config_dsl.rb
248
319
  - lib/tipi/configuration.rb
249
320
  - lib/tipi/digital_fabric.rb
@@ -259,12 +330,15 @@ files:
259
330
  - lib/tipi/http2_adapter.rb
260
331
  - lib/tipi/http2_stream.rb
261
332
  - lib/tipi/rack_adapter.rb
333
+ - lib/tipi/response_extensions.rb
262
334
  - lib/tipi/version.rb
263
335
  - lib/tipi/websocket.rb
336
+ - security/http1.rb
264
337
  - test/coverage.rb
265
338
  - test/eg.rb
266
339
  - test/helper.rb
267
340
  - test/run.rb
341
+ - test/test_http1_parser.rb
268
342
  - test/test_http_server.rb
269
343
  - test/test_request.rb
270
344
  - tipi.gemspec
@@ -292,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
366
  - !ruby/object:Gem::Version
293
367
  version: '0'
294
368
  requirements: []
295
- rubygems_version: 3.0.8
369
+ rubygems_version: 3.1.6
296
370
  signing_key:
297
371
  specification_version: 4
298
372
  summary: Tipi - the All-in-one Web Server for Ruby Apps
data/e DELETED
File without changes