puma 8.1.3 → 8.1.4
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 +4 -4
- data/History.md +25 -0
- data/ext/puma_http11/mini_ssl.c +14 -7
- data/lib/puma/client.rb +19 -1
- data/lib/puma/const.rb +1 -1
- data/lib/puma/launcher.rb +42 -20
- data/lib/puma/minissl.rb +9 -4
- data/lib/puma/response.rb +13 -5
- data/lib/puma/server_plugin_control.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce3c1a00e59638a480313b7808442eb9d1b32bb63b2854500257ad4b1e740e95
|
|
4
|
+
data.tar.gz: 77fbf496b991799ad5e2f7177b4c41b5fb75c3457d274871d0bd7a6bb3178447
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dfae31c951b000b8a5c5fd8e4e2e83851435bb186700c3e0ef2ff598032f18c83732ecfaecd397ceb00b8e10c2ccaa387075c1cbeaecbb25d59df3056385c5dc
|
|
7
|
+
data.tar.gz: db1af56ba2d6aa6f4a9414d9b4ad79bb5305b5dad42d66d716f4b87ec890649aab31827151624475eaef9c6383c1d0f16cd34b053b9340f821f1803be25bb673
|
data/History.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 8.1.4 / 2026-12-01
|
|
2
|
+
|
|
3
|
+
* Bugfixes
|
|
4
|
+
* Return `:wait_readable` instead of raising from `MiniSSL::Socket#read_nonblock` with `exception: false` when the read would block, which broke Action Cable over TLS since 8.0.3 ([#4177])
|
|
5
|
+
* Free MiniSSL engines with Ruby's allocator, fixing heap corruption on mswin ([#4178])
|
|
6
|
+
* Fix a crash when freeing a MiniSSL engine that never got an SSL connection ([#4179])
|
|
7
|
+
* Preserve the SIGTERM exit status when running on JRuby ([#4203])
|
|
8
|
+
* Fix swapped `min` and `max` defaults in `update_thread_pool_min_max` for server plugins ([#4067])
|
|
9
|
+
* Reject a request that has both `Content-Length` and `Transfer-Encoding` with a 400 and close the connection ([#4090], [#4273])
|
|
10
|
+
* Close HTTP/1.0 keep-alive connections when the response body length is unknown ([#4062])
|
|
11
|
+
* Keep the private key out of the `key_pem` error message ([#4061])
|
|
12
|
+
* Validate the CRLF after chunk data when a chunk spans multiple reads ([#4089])
|
|
13
|
+
* Fix `RangeError` for chunk sizes that don't fit in a C `long` ([#4058])
|
|
14
|
+
|
|
1
15
|
## 8.1.3 / 2026-11-25
|
|
2
16
|
|
|
3
17
|
* Security
|
|
@@ -2455,6 +2469,17 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
|
2455
2469
|
* Bugfixes
|
|
2456
2470
|
* Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
|
|
2457
2471
|
|
|
2472
|
+
[#4177]:https://github.com/puma/puma/pull/4177 "PR by Nate Berkopec, merged 2026-11-19"
|
|
2473
|
+
[#4178]:https://github.com/puma/puma/pull/4178 "PR by Nate Berkopec, merged 2026-11-19"
|
|
2474
|
+
[#4179]:https://github.com/puma/puma/pull/4179 "PR by Nate Berkopec, merged 2026-11-19"
|
|
2475
|
+
[#4203]:https://github.com/puma/puma/pull/4203 "PR by Nate Berkopec, merged 2026-11-25"
|
|
2476
|
+
[#4067]:https://github.com/puma/puma/pull/4067 "PR by Yuki Nishijima, merged 2026-11-27"
|
|
2477
|
+
[#4090]:https://github.com/puma/puma/pull/4090 "PR by Nate Berkopec, merged 2026-11-30"
|
|
2478
|
+
[#4273]:https://github.com/puma/puma/pull/4273 "PR by Nate Berkopec, merged 2026-11-30"
|
|
2479
|
+
[#4062]:https://github.com/puma/puma/pull/4062 "PR by Samuel Giddins, merged 2026-11-30"
|
|
2480
|
+
[#4061]:https://github.com/puma/puma/pull/4061 "PR by Samuel Giddins, merged 2026-11-30"
|
|
2481
|
+
[#4089]:https://github.com/puma/puma/pull/4089 "PR by Nate Berkopec, merged 2026-11-30"
|
|
2482
|
+
[#4058]:https://github.com/puma/puma/pull/4058 "PR by Wleeaf, merged 2026-11-30"
|
|
2458
2483
|
[#4135]:https://github.com/puma/puma/pull/4135 "PR by Nate Berkopec, merged 2026-11-15"
|
|
2459
2484
|
[#4108]:https://github.com/puma/puma/pull/4108 "PR by Nate Berkopec, merged 2026-11-15"
|
|
2460
2485
|
[#4124]:https://github.com/puma/puma/pull/4124 "PR by Nate Berkopec, merged 2026-11-15"
|
data/ext/puma_http11/mini_ssl.c
CHANGED
|
@@ -44,15 +44,20 @@ void raise_param_error(const char* caller, const char *param) {
|
|
|
44
44
|
|
|
45
45
|
void engine_free(void *ptr) {
|
|
46
46
|
ms_conn *conn = ptr;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if(conn->ssl) {
|
|
48
|
+
ms_cert_buf* cert_buf = (ms_cert_buf*)SSL_get_app_data(conn->ssl);
|
|
49
|
+
if(cert_buf) {
|
|
50
|
+
OPENSSL_free(cert_buf->buf);
|
|
51
|
+
free(cert_buf);
|
|
52
|
+
}
|
|
53
|
+
SSL_free(conn->ssl);
|
|
54
|
+
} else {
|
|
55
|
+
BIO_free(conn->read);
|
|
56
|
+
BIO_free(conn->write);
|
|
51
57
|
}
|
|
52
|
-
SSL_free(conn->ssl);
|
|
53
58
|
SSL_CTX_free(conn->ctx);
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
ruby_xfree(conn);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
const rb_data_type_t engine_data_type = {
|
|
@@ -377,8 +382,10 @@ sslctx_initialize(VALUE self, VALUE mini_ssl_ctx) {
|
|
|
377
382
|
pkey = PEM_read_bio_PrivateKey(bio, NULL, password_cb, (void *) password);
|
|
378
383
|
|
|
379
384
|
if (SSL_CTX_use_PrivateKey(ctx, pkey) != 1) {
|
|
385
|
+
/* don't echo the key material into the exception message/log */
|
|
386
|
+
EVP_PKEY_free(pkey);
|
|
380
387
|
BIO_free(bio);
|
|
381
|
-
|
|
388
|
+
raise_param_error("SSL_CTX_use_PrivateKey", "key_pem");
|
|
382
389
|
}
|
|
383
390
|
EVP_PKEY_free(pkey);
|
|
384
391
|
BIO_free(bio);
|
data/lib/puma/client.rb
CHANGED
|
@@ -538,6 +538,11 @@ module Puma
|
|
|
538
538
|
|
|
539
539
|
te = @env[TRANSFER_ENCODING2]
|
|
540
540
|
if te
|
|
541
|
+
if @env.key?(CONTENT_LENGTH)
|
|
542
|
+
@error_status_code = 400
|
|
543
|
+
@env[HTTP_CONNECTION] = CLOSE
|
|
544
|
+
raise HttpParserError, "#{TE_ERR_MSG}, cannot be combined with Content-Length"
|
|
545
|
+
end
|
|
541
546
|
te_lwr = te.downcase
|
|
542
547
|
if te.include? ','
|
|
543
548
|
te_ary = te_lwr.split(',').each { |te| te.gsub!(STRIP_OWS, "") }
|
|
@@ -732,10 +737,21 @@ module Puma
|
|
|
732
737
|
@chunked_content_length += @body.write(str)
|
|
733
738
|
end
|
|
734
739
|
|
|
740
|
+
def check_chunk_ending(str, left)
|
|
741
|
+
(left - CHUNK_VALID_ENDING_SIZE...left).each do |i|
|
|
742
|
+
next if i < 0 || i >= str.bytesize
|
|
743
|
+
|
|
744
|
+
unless str.getbyte(i) == CHUNK_VALID_ENDING.getbyte(i - left + CHUNK_VALID_ENDING_SIZE)
|
|
745
|
+
raise HttpParserError, "Chunk size mismatch"
|
|
746
|
+
end
|
|
747
|
+
end
|
|
748
|
+
end
|
|
749
|
+
|
|
735
750
|
def decode_chunk(chunk)
|
|
736
751
|
return finish_last_chunk(@prev_chunk + chunk) if @in_last_chunk
|
|
737
752
|
|
|
738
753
|
if @partial_part_left > 0
|
|
754
|
+
check_chunk_ending(chunk, @partial_part_left)
|
|
739
755
|
if @partial_part_left <= chunk.size
|
|
740
756
|
if @partial_part_left > 2
|
|
741
757
|
write_chunk(chunk[0..(@partial_part_left-3)]) # skip the \r\n
|
|
@@ -800,7 +816,8 @@ module Puma
|
|
|
800
816
|
|
|
801
817
|
len += 2
|
|
802
818
|
|
|
803
|
-
|
|
819
|
+
# StringIO#read takes a C long, so don't ask for more than is buffered
|
|
820
|
+
part = io.read([len, io.size].min)
|
|
804
821
|
|
|
805
822
|
unless part
|
|
806
823
|
@partial_part_left = len
|
|
@@ -821,6 +838,7 @@ module Puma
|
|
|
821
838
|
write_chunk(part)
|
|
822
839
|
@partial_part_left = len - part.size
|
|
823
840
|
when got == len - 1 # edge where we get just \r but not \n
|
|
841
|
+
check_chunk_ending(part, len)
|
|
824
842
|
write_chunk(part[0..-2])
|
|
825
843
|
@partial_part_left = len - part.size
|
|
826
844
|
end
|
data/lib/puma/const.rb
CHANGED
|
@@ -100,7 +100,7 @@ module Puma
|
|
|
100
100
|
# too taxing on performance.
|
|
101
101
|
module Const
|
|
102
102
|
|
|
103
|
-
PUMA_VERSION = VERSION = "8.1.
|
|
103
|
+
PUMA_VERSION = VERSION = "8.1.4"
|
|
104
104
|
CODE_NAME = "Puma Psychosis"
|
|
105
105
|
|
|
106
106
|
PUMA_SERVER_STRING = ["puma", PUMA_VERSION, CODE_NAME].join(" ").freeze
|
data/lib/puma/launcher.rb
CHANGED
|
@@ -18,6 +18,9 @@ module Puma
|
|
|
18
18
|
class Launcher
|
|
19
19
|
autoload :BundlePruner, 'puma/launcher/bundle_pruner'
|
|
20
20
|
|
|
21
|
+
class JRubySigterm < SignalException; end
|
|
22
|
+
private_constant :JRubySigterm
|
|
23
|
+
|
|
21
24
|
# Returns an instance of Launcher
|
|
22
25
|
#
|
|
23
26
|
# +conf+ A Puma::Configuration object indicating how to run the server.
|
|
@@ -199,17 +202,18 @@ module Puma
|
|
|
199
202
|
|
|
200
203
|
# Run the server. This blocks until the server is stopped
|
|
201
204
|
def run
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
@config.plugins.fire_starts self
|
|
205
|
+
return run_server unless Puma.jruby? && Thread.current == Thread.main
|
|
205
206
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
Thread.handle_interrupt(JRubySigterm => :never) do
|
|
208
|
+
begin
|
|
209
|
+
Thread.handle_interrupt(JRubySigterm => :immediate) { run_server(jruby_sigterm: true) }
|
|
210
|
+
rescue JRubySigterm
|
|
211
|
+
do_graceful_stop
|
|
212
|
+
raise
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
rescue JRubySigterm
|
|
216
|
+
raise SignalException, "SIGTERM"
|
|
213
217
|
end
|
|
214
218
|
|
|
215
219
|
# Return all tcp ports the launcher may be using, TCP or SSL
|
|
@@ -253,6 +257,20 @@ module Puma
|
|
|
253
257
|
|
|
254
258
|
private
|
|
255
259
|
|
|
260
|
+
def run_server(jruby_sigterm: false)
|
|
261
|
+
previous_env = get_env
|
|
262
|
+
|
|
263
|
+
@config.plugins.fire_starts self
|
|
264
|
+
|
|
265
|
+
setup_signals(jruby_sigterm)
|
|
266
|
+
set_process_title
|
|
267
|
+
|
|
268
|
+
# This blocks until the server is stopped
|
|
269
|
+
@runner.run
|
|
270
|
+
|
|
271
|
+
do_run_finished(previous_env)
|
|
272
|
+
end
|
|
273
|
+
|
|
256
274
|
def get_env
|
|
257
275
|
if defined?(Bundler)
|
|
258
276
|
env = Bundler::ORIGINAL_ENV.dup
|
|
@@ -425,13 +443,13 @@ module Puma
|
|
|
425
443
|
end
|
|
426
444
|
end
|
|
427
445
|
|
|
428
|
-
def setup_signals
|
|
446
|
+
def setup_signals(jruby_sigterm)
|
|
429
447
|
unless ENV["PUMA_SKIP_SIGUSR2"]
|
|
430
448
|
begin
|
|
431
449
|
Signal.trap "SIGUSR2" do
|
|
432
450
|
restart
|
|
433
451
|
end
|
|
434
|
-
rescue
|
|
452
|
+
rescue StandardError, NotImplementedError
|
|
435
453
|
log "*** SIGUSR2 not implemented, signal based restart unavailable!"
|
|
436
454
|
end
|
|
437
455
|
end
|
|
@@ -441,19 +459,23 @@ module Puma
|
|
|
441
459
|
Signal.trap "SIGUSR1" do
|
|
442
460
|
phased_restart
|
|
443
461
|
end
|
|
444
|
-
rescue
|
|
462
|
+
rescue StandardError, NotImplementedError
|
|
445
463
|
log "*** SIGUSR1 not implemented, signal based restart unavailable!"
|
|
446
464
|
end
|
|
447
465
|
end
|
|
448
466
|
|
|
449
467
|
begin
|
|
450
468
|
Signal.trap "SIGTERM" do
|
|
451
|
-
|
|
452
|
-
|
|
469
|
+
if jruby_sigterm && @options[:raise_exception_on_sigterm]
|
|
470
|
+
Thread.main.raise(JRubySigterm, "SIGTERM")
|
|
471
|
+
else
|
|
472
|
+
# Shortcut the control flow in case raise_exception_on_sigterm is true
|
|
473
|
+
do_graceful_stop
|
|
453
474
|
|
|
454
|
-
|
|
475
|
+
raise(SignalException, "SIGTERM") if @options[:raise_exception_on_sigterm]
|
|
476
|
+
end
|
|
455
477
|
end
|
|
456
|
-
rescue
|
|
478
|
+
rescue StandardError, NotImplementedError
|
|
457
479
|
log "*** SIGTERM not implemented, signal based gracefully stopping unavailable!"
|
|
458
480
|
end
|
|
459
481
|
|
|
@@ -461,7 +483,7 @@ module Puma
|
|
|
461
483
|
Signal.trap "SIGINT" do
|
|
462
484
|
stop
|
|
463
485
|
end
|
|
464
|
-
rescue
|
|
486
|
+
rescue StandardError, NotImplementedError
|
|
465
487
|
log "*** SIGINT not implemented, signal based gracefully stopping unavailable!"
|
|
466
488
|
end
|
|
467
489
|
|
|
@@ -473,7 +495,7 @@ module Puma
|
|
|
473
495
|
stop
|
|
474
496
|
end
|
|
475
497
|
end
|
|
476
|
-
rescue
|
|
498
|
+
rescue StandardError, NotImplementedError
|
|
477
499
|
log "*** SIGHUP not implemented, signal based logs reopening unavailable!"
|
|
478
500
|
end
|
|
479
501
|
|
|
@@ -486,7 +508,7 @@ module Puma
|
|
|
486
508
|
end
|
|
487
509
|
end
|
|
488
510
|
end
|
|
489
|
-
rescue
|
|
511
|
+
rescue StandardError, NotImplementedError
|
|
490
512
|
log "*** SIGINFO/SIGPWR not implemented, signal based backtrace unavailable!"
|
|
491
513
|
end
|
|
492
514
|
end
|
data/lib/puma/minissl.rb
CHANGED
|
@@ -84,13 +84,16 @@ module Puma
|
|
|
84
84
|
output
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def read_nonblock(size, *_)
|
|
87
|
+
def read_nonblock(size, *_, exception: true)
|
|
88
88
|
# *_ is to deal with keyword args that were added
|
|
89
89
|
# at some point (and being used in the wild)
|
|
90
90
|
output = engine_read_all
|
|
91
91
|
return output if output
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
unless flush_write_buffer_nonblock
|
|
94
|
+
raise IO::EAGAINWaitReadable if exception
|
|
95
|
+
return :wait_readable
|
|
96
|
+
end
|
|
94
97
|
|
|
95
98
|
data = @socket.read_nonblock(size, exception: false)
|
|
96
99
|
if data == :wait_readable || data == :wait_writable
|
|
@@ -103,7 +106,8 @@ module Puma
|
|
|
103
106
|
# In the meantime, we can emulate the correct behavior by
|
|
104
107
|
# capturing :wait_readable & :wait_writable and raising EAGAIN
|
|
105
108
|
# ourselves.
|
|
106
|
-
raise IO::EAGAINWaitReadable
|
|
109
|
+
raise IO::EAGAINWaitReadable if exception
|
|
110
|
+
return :wait_readable
|
|
107
111
|
elsif data.nil?
|
|
108
112
|
raise SSLError.exception "HTTP connection?" if bad_tlsv1_3?
|
|
109
113
|
return nil
|
|
@@ -115,7 +119,8 @@ module Puma
|
|
|
115
119
|
|
|
116
120
|
queue_ciphertext
|
|
117
121
|
flush_write_buffer_nonblock
|
|
118
|
-
raise IO::EAGAINWaitReadable
|
|
122
|
+
raise IO::EAGAINWaitReadable if exception
|
|
123
|
+
:wait_readable
|
|
119
124
|
end
|
|
120
125
|
|
|
121
126
|
def write_pending?
|
data/lib/puma/response.rb
CHANGED
|
@@ -211,6 +211,15 @@ module Puma
|
|
|
211
211
|
|
|
212
212
|
cork_socket socket
|
|
213
213
|
|
|
214
|
+
http_10_keep_alive = resp_info[:http_10_keep_alive]
|
|
215
|
+
if http_10_keep_alive && !resp_info[:no_body] && !content_length &&
|
|
216
|
+
!resp_info[:transfer_encoding] && !response_hijack
|
|
217
|
+
# a body of unknown length can only be delimited by closing the
|
|
218
|
+
# connection (RFC 9112 §6.3), so it cannot be kept alive
|
|
219
|
+
keep_alive = http_10_keep_alive = false
|
|
220
|
+
end
|
|
221
|
+
io_buffer << CONNECTION_KEEP_ALIVE if http_10_keep_alive
|
|
222
|
+
|
|
214
223
|
if resp_info[:no_body]
|
|
215
224
|
# 101 (Switching Protocols) doesn't return here or have content_length,
|
|
216
225
|
# it should be using `response_hijack`
|
|
@@ -542,11 +551,10 @@ module Puma
|
|
|
542
551
|
# - HTTP 1.1 assumes the connection will be kept alive if not specified.
|
|
543
552
|
# Only set the header if we're doing something which is not the default
|
|
544
553
|
# for this protocol version
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
end
|
|
554
|
+
# HTTP/1.0 keep-alive is written by prepare_response, which knows whether
|
|
555
|
+
# the body can be delimited without closing the connection
|
|
556
|
+
io_buffer << CONNECTION_CLOSE if http_11 && !resp_info[:keep_alive]
|
|
557
|
+
resp_info[:http_10_keep_alive] = !http_11 && resp_info[:keep_alive]
|
|
550
558
|
resp_info
|
|
551
559
|
end
|
|
552
560
|
private :str_headers
|
|
@@ -22,10 +22,11 @@ module Puma
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Updates the minimum and maximum number of threads in the thread pool.
|
|
25
|
+
# Omitted arguments default to the corresponding current thread limits.
|
|
25
26
|
#
|
|
26
27
|
# @see Puma::Server#update_thread_pool_min_max
|
|
27
28
|
#
|
|
28
|
-
def update_thread_pool_min_max(min:
|
|
29
|
+
def update_thread_pool_min_max(min: min_threads, max: max_threads)
|
|
29
30
|
@server.update_thread_pool_min_max(min: min, max: max)
|
|
30
31
|
end
|
|
31
32
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: puma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evan Phoenix
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-12-01 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: nio4r
|