puma 5.1.1-java → 5.2.0-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

@@ -62,6 +62,12 @@ module Puma
62
62
  end
63
63
  end
64
64
 
65
+ if params['verification_flags']
66
+ ctx.verification_flags = params['verification_flags'].split(',').
67
+ map { |flag| MiniSSL::VERIFICATION_FLAGS.fetch(flag) }.
68
+ inject { |sum, flag| sum ? sum | flag : flag }
69
+ end
70
+
65
71
  ctx
66
72
  end
67
73
 
@@ -9,6 +9,10 @@ module Puma
9
9
  nil
10
10
  end
11
11
 
12
+ def string
13
+ ""
14
+ end
15
+
12
16
  def each
13
17
  end
14
18
 
Binary file
@@ -3,6 +3,8 @@
3
3
  require 'puma/queue_close' unless ::Queue.instance_methods.include? :close
4
4
 
5
5
  module Puma
6
+ class UnsupportedBackend < StandardError; end
7
+
6
8
  # Monitors a collection of IO objects, calling a block whenever
7
9
  # any monitored object either receives data or times out, or when the Reactor shuts down.
8
10
  #
@@ -18,9 +20,12 @@ module Puma
18
20
  # Create a new Reactor to monitor IO objects added by #add.
19
21
  # The provided block will be invoked when an IO has data available to read,
20
22
  # its timeout elapses, or when the Reactor shuts down.
21
- def initialize(&block)
23
+ def initialize(backend, &block)
22
24
  require 'nio'
23
- @selector = NIO::Selector.new
25
+ unless backend == :auto || NIO::Selector.backends.include?(backend)
26
+ raise "unsupported IO selector backend: #{backend} (available backends: #{NIO::Selector.backends.join(', ')})"
27
+ end
28
+ @selector = backend == :auto ? NIO::Selector.new : NIO::Selector.new(backend)
24
29
  @input = Queue.new
25
30
  @timeouts = []
26
31
  @block = block
@@ -55,7 +55,7 @@ module Puma
55
55
  app = Puma::App::Status.new @launcher, token
56
56
 
57
57
  control = Puma::Server.new app, @launcher.events,
58
- { min_threads: 0, max_threads: 1 }
58
+ { min_threads: 0, max_threads: 1, queue_requests: false }
59
59
 
60
60
  control.binder.parse [str], self, 'Starting control server'
61
61
 
@@ -113,8 +113,8 @@ module Puma
113
113
  end
114
114
 
115
115
  STDOUT.reopen stdout, (append ? "a" : "w")
116
- STDOUT.sync = true
117
116
  STDOUT.puts "=== puma startup: #{Time.now} ==="
117
+ STDOUT.flush unless STDOUT.sync
118
118
  end
119
119
 
120
120
  if stderr
@@ -123,8 +123,8 @@ module Puma
123
123
  end
124
124
 
125
125
  STDERR.reopen stderr, (append ? "a" : "w")
126
- STDERR.sync = true
127
126
  STDERR.puts "=== puma startup: #{Time.now} ==="
127
+ STDERR.flush unless STDERR.sync
128
128
  end
129
129
  end
130
130
 
@@ -84,13 +84,14 @@ module Puma
84
84
 
85
85
  @options = options
86
86
 
87
- @early_hints = options.fetch :early_hints, nil
88
- @first_data_timeout = options.fetch :first_data_timeout, FIRST_DATA_TIMEOUT
89
- @min_threads = options.fetch :min_threads, 0
90
- @max_threads = options.fetch :max_threads , (Puma.mri? ? 5 : 16)
91
- @persistent_timeout = options.fetch :persistent_timeout, PERSISTENT_TIMEOUT
92
- @queue_requests = options.fetch :queue_requests, true
93
- @max_fast_inline = options.fetch :max_fast_inline, MAX_FAST_INLINE
87
+ @early_hints = options.fetch :early_hints, nil
88
+ @first_data_timeout = options.fetch :first_data_timeout, FIRST_DATA_TIMEOUT
89
+ @min_threads = options.fetch :min_threads, 0
90
+ @max_threads = options.fetch :max_threads , (Puma.mri? ? 5 : 16)
91
+ @persistent_timeout = options.fetch :persistent_timeout, PERSISTENT_TIMEOUT
92
+ @queue_requests = options.fetch :queue_requests, true
93
+ @max_fast_inline = options.fetch :max_fast_inline, MAX_FAST_INLINE
94
+ @io_selector_backend = options.fetch :io_selector_backend, :auto
94
95
 
95
96
  temp = !!(@options[:environment] =~ /\A(development|test)\z/)
96
97
  @leak_stack_on_error = @options[:environment] ? temp : true
@@ -237,7 +238,7 @@ module Puma
237
238
  @thread_pool.clean_thread_locals = @options[:clean_thread_locals]
238
239
 
239
240
  if @queue_requests
240
- @reactor = Reactor.new(&method(:reactor_wakeup))
241
+ @reactor = Reactor.new(@io_selector_backend, &method(:reactor_wakeup))
241
242
  @reactor.run
242
243
  end
243
244
 
@@ -494,62 +495,6 @@ module Puma
494
495
 
495
496
  # :nocov:
496
497
 
497
- # Given the request +env+ from +client+ and the partial body +body+
498
- # plus a potential Content-Length value +cl+, finish reading
499
- # the body and return it.
500
- #
501
- # If the body is larger than MAX_BODY, a Tempfile object is used
502
- # for the body, otherwise a StringIO is used.
503
- # @deprecated 6.0.0
504
- #
505
- def read_body(env, client, body, cl)
506
- content_length = cl.to_i
507
-
508
- remain = content_length - body.bytesize
509
-
510
- return StringIO.new(body) if remain <= 0
511
-
512
- # Use a Tempfile if there is a lot of data left
513
- if remain > MAX_BODY
514
- stream = Tempfile.new(Const::PUMA_TMP_BASE)
515
- stream.binmode
516
- else
517
- # The body[0,0] trick is to get an empty string in the same
518
- # encoding as body.
519
- stream = StringIO.new body[0,0]
520
- end
521
-
522
- stream.write body
523
-
524
- # Read an odd sized chunk so we can read even sized ones
525
- # after this
526
- chunk = client.readpartial(remain % CHUNK_SIZE)
527
-
528
- # No chunk means a closed socket
529
- unless chunk
530
- stream.close
531
- return nil
532
- end
533
-
534
- remain -= stream.write(chunk)
535
-
536
- # Read the rest of the chunks
537
- while remain > 0
538
- chunk = client.readpartial(CHUNK_SIZE)
539
- unless chunk
540
- stream.close
541
- return nil
542
- end
543
-
544
- remain -= stream.write(chunk)
545
- end
546
-
547
- stream.rewind
548
-
549
- return stream
550
- end
551
- # :nocov:
552
-
553
498
  # Handle various error types thrown by Client I/O operations.
554
499
  def client_error(e, client)
555
500
  # Swallow, do not log
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2021-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -53,10 +53,12 @@ files:
53
53
  - docs/jungle/rc.d/README.md
54
54
  - docs/jungle/rc.d/puma
55
55
  - docs/jungle/rc.d/puma.conf
56
+ - docs/kubernetes.md
56
57
  - docs/nginx.md
57
58
  - docs/plugins.md
58
59
  - docs/restart.md
59
60
  - docs/signals.md
61
+ - docs/stats.md
60
62
  - docs/systemd.md
61
63
  - ext/puma_http11/PumaHttp11Service.java
62
64
  - ext/puma_http11/ext_help.h