puma 8.0.3-java → 8.1.0-java

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +115 -0
  3. data/README.md +20 -5
  4. data/docs/6.0-Upgrade.md +1 -1
  5. data/docs/8.0-Upgrade.md +2 -2
  6. data/docs/deployment.md +3 -3
  7. data/docs/fork_worker.md +34 -4
  8. data/docs/kubernetes.md +3 -3
  9. data/docs/plugins.md +2 -2
  10. data/docs/puma_support.md +78 -0
  11. data/docs/rails_dev_mode.md +2 -2
  12. data/docs/restart.md +4 -3
  13. data/docs/signals.md +2 -2
  14. data/docs/stats.md +5 -5
  15. data/docs/systemd.md +4 -2
  16. data/docs/testing_benchmarks_local_files.md +1 -1
  17. data/docs/testing_test_rackup_ci_files.md +2 -2
  18. data/ext/puma_http11/extconf.rb +2 -0
  19. data/ext/puma_http11/http11_parser.c +6 -2
  20. data/ext/puma_http11/http11_parser_common.rl +4 -1
  21. data/ext/puma_http11/mini_ssl.c +8 -4
  22. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +36 -36
  23. data/ext/puma_http11/puma_http11.c +24 -0
  24. data/lib/puma/binder.rb +29 -0
  25. data/lib/puma/cli.rb +6 -0
  26. data/lib/puma/client.rb +75 -29
  27. data/lib/puma/client_env.rb +32 -18
  28. data/lib/puma/cluster/worker.rb +109 -33
  29. data/lib/puma/cluster/worker_handle.rb +16 -0
  30. data/lib/puma/cluster.rb +173 -44
  31. data/lib/puma/commonlogger.rb +3 -3
  32. data/lib/puma/configuration.rb +22 -3
  33. data/lib/puma/const.rb +11 -9
  34. data/lib/puma/dsl.rb +265 -91
  35. data/lib/puma/launcher.rb +6 -4
  36. data/lib/puma/minissl.rb +1 -1
  37. data/lib/puma/plugin/systemd.rb +1 -1
  38. data/lib/puma/puma_http11.jar +0 -0
  39. data/lib/puma/response.rb +13 -5
  40. data/lib/puma/runner.rb +5 -1
  41. data/lib/puma/sd_notify.rb +4 -1
  42. data/lib/puma/server.rb +45 -20
  43. data/lib/puma/thread_pool.rb +12 -1
  44. data/lib/puma.rb +1 -1
  45. metadata +3 -2
@@ -133,6 +133,7 @@ module Puma
133
133
  class NotClampedError < StandardError; end
134
134
 
135
135
  DEFAULTS = {
136
+ allow_underscore_headers: true,
136
137
  auto_trim_time: 30,
137
138
  binds: ['tcp://[::]:9292'.freeze],
138
139
  debug: false,
@@ -284,11 +285,17 @@ module Puma
284
285
  #
285
286
  # This also calls load if it hasn't been called yet.
286
287
  def clamp
288
+ if @clamped
289
+ warn "Configuration already clamped, calling clamp multiple times is deprecated and will raise in Puma v9"
290
+ return options
291
+ end
292
+
287
293
  load unless @loaded
288
294
  run_mode_hooks
289
295
  set_conditional_default_options
290
296
  @_options.finalize_values
291
297
  rewrite_unavailable_ipv6_binds!
298
+ validate_options
292
299
  @clamped = true
293
300
  warn_hooks
294
301
  options
@@ -357,8 +364,7 @@ module Puma
357
364
  block.call arg
358
365
  end
359
366
  rescue => e
360
- log_writer.log "WARNING hook #{key} failed with exception (#{e.class}) #{e.message}"
361
- log_writer.debug e.backtrace.join("\n")
367
+ handle_hook_error e, key, log_writer
362
368
  end
363
369
  end
364
370
  end
@@ -399,6 +405,15 @@ module Puma
399
405
 
400
406
  private
401
407
 
408
+ def handle_hook_error(e, key, log_writer)
409
+ if (handler = options[:hook_error_handler])
410
+ handler.call(e, key)
411
+ else
412
+ log_writer.log "WARNING hook #{key} failed with exception (#{e.class}) #{e.message}"
413
+ log_writer.debug e.backtrace.join("\n")
414
+ end
415
+ end
416
+
402
417
  def rewrite_unavailable_ipv6_binds!
403
418
  return if self.class.ipv6_interface_available?
404
419
 
@@ -492,7 +507,7 @@ module Puma
492
507
  @_options.all_of(key).each(&:call)
493
508
 
494
509
  unless @_options[:workers] == workers_before
495
- raise "cannot change the number of workers inside a #{key} configuration hook"
510
+ raise "Cannot change the number of workers inside a #{key} configuration hook"
496
511
  end
497
512
  end
498
513
 
@@ -501,6 +516,10 @@ module Puma
501
516
  (@_options[:workers] > 1) && Puma.forkable?
502
517
  end
503
518
 
519
+ def validate_options
520
+ raise "fork_worker and mold_worker cannot be used together" if @_options[:fork_worker] && @_options[:mold_worker]
521
+ end
522
+
504
523
  def warn_hooks
505
524
  return if options[:workers] > 0
506
525
  return if options[:silence_fork_callback_warning]
data/lib/puma/const.rb CHANGED
@@ -100,8 +100,8 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "8.0.3"
104
- CODE_NAME = "Into the Arena"
103
+ PUMA_VERSION = VERSION = "8.1.0"
104
+ CODE_NAME = "Puma Psychosis"
105
105
 
106
106
  PUMA_SERVER_STRING = ["puma", PUMA_VERSION, CODE_NAME].join(" ").freeze
107
107
 
@@ -150,12 +150,12 @@ module Puma
150
150
  REQUEST_METHOD = "REQUEST_METHOD"
151
151
  HEAD = "HEAD"
152
152
 
153
- # based on https://www.rfc-editor.org/rfc/rfc9110.html#name-overview,
154
- # with CONNECT removed, and PATCH added
155
- SUPPORTED_HTTP_METHODS = %w[HEAD GET POST PUT DELETE OPTIONS TRACE PATCH].freeze
153
+ # based on https://www.rfc-editor.org/rfc/rfc9110.html#name-overview and https://www.rfc-editor.org/rfc/rfc10008.html,
154
+ # with CONNECT removed, and PATCH & QUERY added
155
+ SUPPORTED_HTTP_METHODS = %w[HEAD GET POST PUT DELETE OPTIONS TRACE PATCH QUERY].freeze
156
156
 
157
157
  # list from https://www.iana.org/assignments/http-methods/http-methods.xhtml
158
- # as of 04-May-23
158
+ # as of 17-Jun-26, with QUERY added based on https://www.rfc-editor.org/rfc/rfc10008.html
159
159
  IANA_HTTP_METHODS = %w[
160
160
  ACL
161
161
  BASELINE-CONTROL
@@ -185,6 +185,7 @@ module Puma
185
185
  PROPFIND
186
186
  PROPPATCH
187
187
  PUT
188
+ QUERY
188
189
  REBIND
189
190
  REPORT
190
191
  SEARCH
@@ -235,6 +236,7 @@ module Puma
235
236
  PUMA_SOCKET = "puma.socket"
236
237
  PUMA_CONFIG = "puma.config"
237
238
  PUMA_PEERCERT = "puma.peercert"
239
+ PUMA_UNDERSCORE_HEADERS = "puma.underscore_headers"
238
240
 
239
241
  HTTP = "http"
240
242
  HTTPS = "https"
@@ -283,9 +285,8 @@ module Puma
283
285
  # header values can contain HTAB?
284
286
  ILLEGAL_HEADER_VALUE_REGEX = /[\x00-\x08\x0A-\x1F]/.freeze
285
287
 
286
- # The keys of headers that should not be convert to underscore
287
- # normalized versions. These headers are ignored at the request reading layer,
288
- # but if we normalize them after reading, it's just confusing for the application.
288
+ # Framing aliases must never be normalized into standard header keys.
289
+ # Client#setup_body rejects requests containing these keys before body reads.
289
290
  UNMASKABLE_HEADERS = {
290
291
  "HTTP_TRANSFER,ENCODING" => true,
291
292
  "HTTP_CONTENT,LENGTH" => true,
@@ -306,6 +307,7 @@ module Puma
306
307
  PIPE_TERM = "t"
307
308
  PIPE_PING = "p"
308
309
  PIPE_IDLE = "i"
310
+ PIPE_MOLD = "m"
309
311
  end
310
312
  end
311
313
  end