tipi 0.45 → 0.50

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6abb7798a69adc36e18dda822f7ff025f9f9e286eba50ccaf3905a74f29ef32
4
- data.tar.gz: 41ee73bf589d2d4bd764aa58cb71e43477bc52caae708bd05ae4ae6372275415
3
+ metadata.gz: 4b42be983897e061a24d23149741ec87830217ca0b50cab1fbe7047907515bb6
4
+ data.tar.gz: 63cde71869ead6c1767850759e6e5a90247788ba2f43ed67af67e11f5054b361
5
5
  SHA512:
6
- metadata.gz: b23c0bfe27b9e6ff203508ab1a24ecbf10d954996ce9af2045a7d427ccec5746e9ef9df146353e4c134a56c12c4f2518141b46fe342123613c3da713a086a90f
7
- data.tar.gz: a2f0fdc533ab39a23dad733535a9371a44a5809485c04114d0e054f4cb4bcb47b0cb27a266d5d58a7e01b8db06daf79a3aa944151de50e61da33f824e4651e43
6
+ metadata.gz: 6492e46303652f65140124f5ea0855b9c763512fd8b42133fbf8ebdd94877ba666751237601fcb26ec36e347d8314ce6b4fd955e161093e9cb130174e6d834a1
7
+ data.tar.gz: 43d52f3291ff443d0a250b6d99e75c888f645165c022af4bbfd3fa1272d2ac47fd52827221dd797f2e75315ae5274c6fb488b323822d15824eaaec669a708094
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## 0.50 2022-02-10
2
+
3
+ - Update Qeweney
4
+
5
+ ## 0.49 2022-02-07
6
+
7
+ - Update Polyphony
8
+
9
+ ## 0.48 2022-02-04
10
+
11
+ - Update dependencies
12
+ - Fix variable name in `Tipi.verify_path` (#16) - thanks @dm1try
13
+
14
+ ## 0.47 2202-02-03
15
+
16
+ - Update H1P dependency
17
+
18
+ ## 0.46 2022-02-01
19
+
20
+ - Allow setting valid hosts
21
+ - Change interface of Qeweney apps to use #run (#15)
22
+ - Close server listener before terminating connections
23
+
1
24
  ## 0.45 2021-10-25
2
25
 
3
26
  - Remove `http_parser.rb` dependency (#14) - thanks @SwagDevOps
data/Gemfile.lock CHANGED
@@ -6,32 +6,32 @@ PATH
6
6
  PATH
7
7
  remote: ../h1p
8
8
  specs:
9
- h1p (0.2)
9
+ h1p (0.3)
10
10
 
11
11
  PATH
12
12
  remote: ../polyphony
13
13
  specs:
14
- polyphony (0.71)
14
+ polyphony (0.77)
15
15
 
16
16
  PATH
17
17
  remote: ../qeweney
18
18
  specs:
19
- qeweney (0.14)
19
+ qeweney (0.17)
20
20
  escape_utils (~> 1.2.1)
21
21
 
22
22
  PATH
23
23
  remote: .
24
24
  specs:
25
- tipi (0.45)
26
- acme-client (~> 2.0.8)
25
+ tipi (0.50)
26
+ acme-client (~> 2.0.9)
27
27
  ever (~> 0.1)
28
28
  extralite (~> 1.2)
29
- h1p (~> 0.2)
29
+ h1p (~> 0.3)
30
30
  http-2 (~> 0.11)
31
31
  localhost (~> 1.1.4)
32
32
  msgpack (~> 1.4.2)
33
- polyphony (~> 0.71)
34
- qeweney (~> 0.14)
33
+ polyphony (~> 0.77)
34
+ qeweney (~> 0.17)
35
35
  rack (>= 2.0.8, < 2.3.0)
36
36
  websocket (~> 1.2.8)
37
37
 
@@ -44,32 +44,36 @@ GEM
44
44
  rack (>= 1.6.0)
45
45
  docile (1.4.0)
46
46
  escape_utils (1.2.1)
47
- extralite (1.4)
48
- faraday (1.8.0)
47
+ extralite (1.11)
48
+ faraday (1.9.3)
49
49
  faraday-em_http (~> 1.0)
50
50
  faraday-em_synchrony (~> 1.0)
51
51
  faraday-excon (~> 1.1)
52
- faraday-httpclient (~> 1.0.1)
52
+ faraday-httpclient (~> 1.0)
53
+ faraday-multipart (~> 1.0)
53
54
  faraday-net_http (~> 1.0)
54
- faraday-net_http_persistent (~> 1.1)
55
+ faraday-net_http_persistent (~> 1.0)
55
56
  faraday-patron (~> 1.0)
56
57
  faraday-rack (~> 1.0)
57
- multipart-post (>= 1.2, < 3)
58
+ faraday-retry (~> 1.0)
58
59
  ruby2_keywords (>= 0.0.4)
59
60
  faraday-em_http (1.0.0)
60
61
  faraday-em_synchrony (1.0.0)
61
62
  faraday-excon (1.1.0)
62
63
  faraday-httpclient (1.0.1)
64
+ faraday-multipart (1.0.3)
65
+ multipart-post (>= 1.2, < 3)
63
66
  faraday-net_http (1.0.1)
64
67
  faraday-net_http_persistent (1.2.0)
65
68
  faraday-patron (1.0.0)
66
69
  faraday-rack (1.0.0)
70
+ faraday-retry (1.0.3)
67
71
  http-2 (0.11.0)
68
- json (2.5.1)
72
+ json (2.6.1)
69
73
  localhost (1.1.9)
70
74
  memory_profiler (1.0.0)
71
75
  minitest (5.11.3)
72
- msgpack (1.4.2)
76
+ msgpack (1.4.4)
73
77
  multipart-post (2.1.1)
74
78
  rack (2.2.3)
75
79
  rake (13.0.6)
@@ -97,4 +101,4 @@ DEPENDENCIES
97
101
  tipi!
98
102
 
99
103
  BUNDLED WITH
100
- 2.1.4
104
+ 2.3.3
data/examples/hello.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- def app
4
- ->(req) { req.respond('Hello, world!', 'Content-Type' => 'text/plain') }
5
- end
3
+ run { |req|
4
+ req.respond('Hello, world!')
5
+ }
data/examples/hello.ru CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  run lambda { |env|
4
4
  [
5
- 200,
6
- {"Content-Type" => "text/plain"},
7
- ["Hello, world!"]
5
+ 200,
6
+ {"Content-Type" => "text/plain"},
7
+ ["Hello, world!"]
8
8
  ]
9
9
  }
data/lib/tipi/acme.rb CHANGED
@@ -10,10 +10,11 @@ module Tipi
10
10
  end
11
11
 
12
12
  class CertificateManager
13
- def initialize(master_ctx:, store:, challenge_handler:)
13
+ def initialize(master_ctx:, store:, challenge_handler:, valid_hosts:)
14
14
  @master_ctx = master_ctx
15
15
  @store = store
16
16
  @challenge_handler = challenge_handler
17
+ @valid_hosts = valid_hosts
17
18
  @contexts = {}
18
19
  @requests = Polyphony::Queue.new
19
20
  @worker = spin { run }
@@ -41,6 +42,10 @@ module Tipi
41
42
  def get_ctx(name)
42
43
  state = { ctx: nil }
43
44
 
45
+ if @valid_hosts
46
+ return nil unless @valid_hosts.include?(name)
47
+ end
48
+
44
49
  ready_ctx = @contexts[name]
45
50
  return ready_ctx if ready_ctx
46
51
  return @master_ctx if name =~ IP_REGEXP
data/lib/tipi/cli.rb CHANGED
@@ -64,7 +64,7 @@ module Tipi
64
64
  def self.verify_path(path)
65
65
  return if File.file?(path) || File.directory?(path)
66
66
 
67
- puts "Invalid path specified #{opts[:path]}"
67
+ puts "Invalid path specified #{path}"
68
68
  exit!
69
69
  end
70
70
 
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tipi'
4
+
5
+ module Kernel
6
+ def run(app = nil, &block)
7
+ Tipi.app = app || block
8
+ end
9
+ end
10
+
11
+ module Tipi
12
+ class << self
13
+ attr_writer :app
14
+
15
+ def app
16
+ return @app if @app
17
+
18
+ raise 'No app define. The app to run should be set using `Tipi.app = ...`'
19
+ end
20
+
21
+ def run_sites(site_map)
22
+ sites = site_map.each_with_object({}) { |(k, v), h| h[k] = v.to_proc }
23
+ valid_hosts = sites.keys
24
+
25
+ @app = ->(req) {
26
+ handler = sites[req.host]
27
+ if handler
28
+ handler.call(req)
29
+ else
30
+ req.respond(nil, ':status' => Qeweney::Status::NOT_FOUND)
31
+ end
32
+ }
33
+
34
+ @app.define_singleton_method(:valid_hosts) { valid_hosts }
35
+ end
36
+ end
37
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'tipi'
4
4
  require 'localhost/authority'
5
+ require_relative './extensions'
5
6
 
6
7
  module Tipi
7
8
  class Controller
@@ -89,7 +90,7 @@ module Tipi
89
90
  def tipi_service
90
91
  puts "Loading Tipi app from #{@path}"
91
92
  require(@path)
92
- app = Object.send(:app)
93
+ app = Tipi.app
93
94
  web_service(app)
94
95
  # proc { spin { Object.run } }
95
96
  end
@@ -200,7 +201,8 @@ module Tipi
200
201
  certificate_manager = Tipi::ACME::CertificateManager.new(
201
202
  master_ctx: ctx,
202
203
  store: certificate_store,
203
- challenge_handler: challenge_handler
204
+ challenge_handler: challenge_handler,
205
+ valid_hosts: app.respond_to?(:valid_hosts) ? app.valid_hosts : nil
204
206
  )
205
207
  http_app = certificate_manager.challenge_routing_app(redirect_app)
206
208
 
@@ -277,8 +279,8 @@ module Tipi
277
279
 
278
280
  def finalize_listener(server)
279
281
  fiber = Fiber.current
280
- gracefully_terminate_conections(fiber) if fiber.graceful_shutdown?
281
282
  server.close
283
+ gracefully_terminate_conections(fiber) if fiber.graceful_shutdown?
282
284
  rescue Polyphony::BaseException
283
285
  raise
284
286
  rescue Exception => e
@@ -5,6 +5,7 @@ require 'localhost/authority'
5
5
  require 'http/parser'
6
6
  require 'qeweney'
7
7
  require 'tipi/rack_adapter'
8
+ require_relative './extensions'
8
9
 
9
10
  module Tipi
10
11
  class Listener
@@ -360,7 +361,10 @@ module Tipi
360
361
  def tipi_service
361
362
  puts "Loading Tipi app from #{@path}"
362
363
  require(@path)
363
- app = Object.send(:app)
364
+ app = Tipi.app
365
+ if !app
366
+ raise "No app define. The app to run should be set using `Tipi.app = ...`"
367
+ end
364
368
  web_service(app)
365
369
  end
366
370
 
@@ -15,7 +15,7 @@ module Tipi
15
15
  @conn = conn
16
16
  @opts = opts
17
17
  @first = true
18
- @parser = H1P::Parser.new(@conn)
18
+ @parser = H1P::Parser.new(@conn, :server)
19
19
  end
20
20
 
21
21
  def each(&block)
@@ -6,7 +6,6 @@ require 'qeweney/request'
6
6
  module Tipi
7
7
  # Manages an HTTP 2 stream
8
8
  class HTTP2StreamHandler
9
- attr_accessor :__next__
10
9
  attr_reader :conn
11
10
 
12
11
  def initialize(adapter, stream, conn, first, &block)
data/lib/tipi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tipi
4
- VERSION = '0.45'
4
+ VERSION = '0.50'
5
5
  end
data/tipi.gemspec CHANGED
@@ -19,16 +19,16 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.executables = ['tipi']
21
21
 
22
- s.add_runtime_dependency 'polyphony', '~>0.71'
22
+ s.add_runtime_dependency 'polyphony', '~>0.77'
23
23
  s.add_runtime_dependency 'ever', '~>0.1'
24
- s.add_runtime_dependency 'qeweney', '~>0.14'
24
+ s.add_runtime_dependency 'qeweney', '~>0.17'
25
25
  s.add_runtime_dependency 'extralite', '~>1.2'
26
- s.add_runtime_dependency 'h1p', '~>0.2'
26
+ s.add_runtime_dependency 'h1p', '~>0.3'
27
27
 
28
28
  s.add_runtime_dependency 'http-2', '~>0.11'
29
29
  s.add_runtime_dependency 'rack', '>=2.0.8', '<2.3.0'
30
30
  s.add_runtime_dependency 'websocket', '~>1.2.8'
31
- s.add_runtime_dependency 'acme-client', '~>2.0.8'
31
+ s.add_runtime_dependency 'acme-client', '~>2.0.9'
32
32
  s.add_runtime_dependency 'localhost', '~>1.1.4'
33
33
 
34
34
  # for digital fabric
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.45'
4
+ version: '0.50'
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: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2022-02-10 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.71'
19
+ version: '0.77'
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.71'
26
+ version: '0.77'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ever
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.14'
47
+ version: '0.17'
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.14'
54
+ version: '0.17'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: extralite
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.2'
75
+ version: '0.3'
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.2'
82
+ version: '0.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: http-2
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 2.0.8
137
+ version: 2.0.9
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: 2.0.8
144
+ version: 2.0.9
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: localhost
147
147
  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
@@ -319,6 +319,7 @@ files:
319
319
  - lib/tipi/controller.rb
320
320
  - lib/tipi/controller/bare_polyphony.rb
321
321
  - lib/tipi/controller/bare_stock.rb
322
+ - lib/tipi/controller/extensions.rb
322
323
  - lib/tipi/controller/stock_http1_adapter.rb
323
324
  - lib/tipi/controller/web_polyphony.rb
324
325
  - lib/tipi/controller/web_stock.rb
@@ -351,7 +352,7 @@ licenses:
351
352
  - MIT
352
353
  metadata:
353
354
  source_code_uri: https://github.com/digital-fabric/tipi
354
- post_install_message:
355
+ post_install_message:
355
356
  rdoc_options:
356
357
  - "--title"
357
358
  - tipi
@@ -370,8 +371,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
371
  - !ruby/object:Gem::Version
371
372
  version: '0'
372
373
  requirements: []
373
- rubygems_version: 3.1.2
374
- signing_key:
374
+ rubygems_version: 3.3.3
375
+ signing_key:
375
376
  specification_version: 4
376
377
  summary: Tipi - the All-in-one Web Server for Ruby Apps
377
378
  test_files: []