puma 7.2.4 → 8.0.0
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 +38 -37
- data/README.md +1 -2
- data/docs/5.0-Upgrade.md +98 -0
- data/docs/6.0-Upgrade.md +56 -0
- data/docs/7.0-Upgrade.md +52 -0
- data/docs/8.0-Upgrade.md +100 -0
- data/docs/grpc.md +62 -0
- data/docs/images/favicon.svg +1 -0
- data/docs/images/running-puma.svg +1 -0
- data/docs/images/standard-logo.svg +1 -0
- data/docs/signals.md +1 -1
- data/ext/puma_http11/http11_parser.java.rl +51 -65
- data/ext/puma_http11/mini_ssl.c +3 -10
- data/ext/puma_http11/org/jruby/puma/EnvKey.java +241 -0
- data/ext/puma_http11/org/jruby/puma/Http11.java +168 -104
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +71 -85
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +34 -44
- data/ext/puma_http11/puma_http11.c +3 -4
- data/lib/puma/binder.rb +3 -4
- data/lib/puma/cli.rb +1 -1
- data/lib/puma/client.rb +114 -196
- data/lib/puma/client_env.rb +171 -0
- data/lib/puma/cluster.rb +1 -1
- data/lib/puma/commonlogger.rb +0 -3
- data/lib/puma/configuration.rb +69 -8
- data/lib/puma/const.rb +3 -7
- data/lib/puma/control_cli.rb +4 -15
- data/lib/puma/detect.rb +11 -0
- data/lib/puma/dsl.rb +75 -22
- data/lib/puma/error_logger.rb +1 -2
- data/lib/puma/launcher.rb +3 -4
- data/lib/puma/minissl.rb +56 -101
- data/lib/puma/reactor.rb +3 -35
- data/lib/puma/{request.rb → response.rb} +16 -201
- data/lib/puma/runner.rb +1 -2
- data/lib/puma/server.rb +84 -120
- data/lib/puma/server_plugin_control.rb +32 -0
- data/lib/puma/thread_pool.rb +129 -23
- data/lib/puma/util.rb +4 -8
- data/lib/rack/handler/puma.rb +1 -1
- metadata +15 -4
|
@@ -383,41 +383,36 @@ public class MiniSSL extends RubyObject { // MiniSSL::Engine
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
MiniSSLBuffer inboundAppData = new MiniSSLBuffer(engine.getSession().getApplicationBufferSize());
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
res = doOp(SSLOperation.UNWRAP, inboundNetData, inboundAppData);
|
|
402
|
-
if (res.getStatus() == Status.BUFFER_UNDERFLOW) {
|
|
403
|
-
// need more data before we can shake more hands
|
|
404
|
-
done = true;
|
|
405
|
-
}
|
|
406
|
-
handshakeStatus = res.getHandshakeStatus();
|
|
407
|
-
break;
|
|
408
|
-
case NEED_TASK:
|
|
409
|
-
Runnable runnable;
|
|
410
|
-
while ((runnable = engine.getDelegatedTask()) != null) {
|
|
411
|
-
runnable.run();
|
|
412
|
-
}
|
|
413
|
-
handshakeStatus = engine.getHandshakeStatus();
|
|
414
|
-
break;
|
|
415
|
-
default:
|
|
386
|
+
doOp(SSLOperation.UNWRAP, inboundNetData, inboundAppData);
|
|
387
|
+
|
|
388
|
+
HandshakeStatus handshakeStatus = engine.getHandshakeStatus();
|
|
389
|
+
boolean done = false;
|
|
390
|
+
while (!done) {
|
|
391
|
+
SSLEngineResult res;
|
|
392
|
+
switch (handshakeStatus) {
|
|
393
|
+
case NEED_WRAP:
|
|
394
|
+
res = doOp(SSLOperation.WRAP, inboundAppData, outboundNetData);
|
|
395
|
+
handshakeStatus = res.getHandshakeStatus();
|
|
396
|
+
break;
|
|
397
|
+
case NEED_UNWRAP:
|
|
398
|
+
res = doOp(SSLOperation.UNWRAP, inboundNetData, inboundAppData);
|
|
399
|
+
if (res.getStatus() == Status.BUFFER_UNDERFLOW) {
|
|
400
|
+
// need more data before we can shake more hands
|
|
416
401
|
done = true;
|
|
417
|
-
|
|
402
|
+
}
|
|
403
|
+
handshakeStatus = res.getHandshakeStatus();
|
|
404
|
+
break;
|
|
405
|
+
case NEED_TASK:
|
|
406
|
+
Runnable runnable;
|
|
407
|
+
while ((runnable = engine.getDelegatedTask()) != null) {
|
|
408
|
+
runnable.run();
|
|
409
|
+
}
|
|
410
|
+
handshakeStatus = engine.getHandshakeStatus();
|
|
411
|
+
break;
|
|
412
|
+
default:
|
|
413
|
+
done = true;
|
|
418
414
|
}
|
|
419
|
-
}
|
|
420
|
-
inboundNetData.hasRemaining() && inboundNetData.position() > consumedTo);
|
|
415
|
+
}
|
|
421
416
|
|
|
422
417
|
if (inboundNetData.hasRemaining()) {
|
|
423
418
|
inboundNetData.compact();
|
|
@@ -487,19 +482,14 @@ public class MiniSSL extends RubyObject { // MiniSSL::Engine
|
|
|
487
482
|
|
|
488
483
|
@JRubyMethod
|
|
489
484
|
public IRubyObject shutdown() {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
// Generate close_notify for MiniSSL::Socket#close to send.
|
|
496
|
-
engine.closeOutbound();
|
|
497
|
-
try {
|
|
498
|
-
doOp(SSLOperation.WRAP, outboundAppData, outboundNetData);
|
|
499
|
-
} catch (SSLException e) {
|
|
485
|
+
if (closed || engine.isInboundDone() && engine.isOutboundDone()) {
|
|
486
|
+
if (engine.isOutboundDone()) {
|
|
487
|
+
engine.closeOutbound();
|
|
488
|
+
}
|
|
500
489
|
return getRuntime().getTrue();
|
|
490
|
+
} else {
|
|
491
|
+
return getRuntime().getFalse();
|
|
501
492
|
}
|
|
502
|
-
return getRuntime().getFalse();
|
|
503
493
|
}
|
|
504
494
|
|
|
505
495
|
private static RubyClass getSSLError(Ruby runtime) {
|
|
@@ -385,8 +385,7 @@ static VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data, VALUE st
|
|
|
385
385
|
long dlen = 0;
|
|
386
386
|
|
|
387
387
|
from = FIX2INT(start);
|
|
388
|
-
dptr
|
|
389
|
-
dlen = (long)RSTRING_LEN(data);
|
|
388
|
+
RSTRING_GETMEM(data, dptr, dlen);
|
|
390
389
|
|
|
391
390
|
if(from >= dlen) {
|
|
392
391
|
rb_raise(eHttpParserError, "%s", "Requested start is after data buffer end.");
|
|
@@ -399,7 +398,7 @@ static VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data, VALUE st
|
|
|
399
398
|
if(puma_parser_has_error(http)) {
|
|
400
399
|
rb_raise(eHttpParserError, "%s", "Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?");
|
|
401
400
|
} else {
|
|
402
|
-
return
|
|
401
|
+
return INT2FIX(puma_parser_nread(http));
|
|
403
402
|
}
|
|
404
403
|
}
|
|
405
404
|
}
|
|
@@ -445,7 +444,7 @@ static VALUE HttpParser_nread(VALUE self)
|
|
|
445
444
|
{
|
|
446
445
|
puma_parser *http = HttpParser_unwrap(self);
|
|
447
446
|
|
|
448
|
-
return
|
|
447
|
+
return INT2FIX(http->nread);
|
|
449
448
|
}
|
|
450
449
|
|
|
451
450
|
/**
|
data/lib/puma/binder.rb
CHANGED
|
@@ -236,7 +236,7 @@ module Puma
|
|
|
236
236
|
# Load localhost authority if not loaded.
|
|
237
237
|
# Ruby 3 `values_at` accepts an array, earlier do not
|
|
238
238
|
if params.values_at(*cert_key).all? { |v| v.to_s.empty? }
|
|
239
|
-
ctx = localhost_authority && localhost_authority_context
|
|
239
|
+
ctx = localhost_authority && localhost_authority_context
|
|
240
240
|
end
|
|
241
241
|
|
|
242
242
|
ctx ||=
|
|
@@ -313,7 +313,7 @@ module Puma
|
|
|
313
313
|
@localhost_authority ||= Localhost::Authority.fetch if defined?(Localhost::Authority) && !Puma::IS_JRUBY
|
|
314
314
|
end
|
|
315
315
|
|
|
316
|
-
def localhost_authority_context
|
|
316
|
+
def localhost_authority_context
|
|
317
317
|
return unless localhost_authority
|
|
318
318
|
|
|
319
319
|
key_path, crt_path = if [:key_path, :certificate_path].all? { |m| localhost_authority.respond_to?(m) }
|
|
@@ -322,8 +322,7 @@ module Puma
|
|
|
322
322
|
local_certificates_path = File.expand_path("~/.localhost")
|
|
323
323
|
[File.join(local_certificates_path, "localhost.key"), File.join(local_certificates_path, "localhost.crt")]
|
|
324
324
|
end
|
|
325
|
-
|
|
326
|
-
MiniSSL::ContextBuilder.new(params.merge("key" => key_path, "cert" => crt_path), @log_writer).context
|
|
325
|
+
MiniSSL::ContextBuilder.new({ "key" => key_path, "cert" => crt_path }, @log_writer).context
|
|
327
326
|
end
|
|
328
327
|
|
|
329
328
|
# Tell the server to listen on host +host+, port +port+.
|
data/lib/puma/cli.rb
CHANGED
|
@@ -148,7 +148,7 @@ module Puma
|
|
|
148
148
|
|
|
149
149
|
o.on "-p", "--port PORT", "Define the TCP port to bind to",
|
|
150
150
|
"Use -b for more advanced options" do |arg|
|
|
151
|
-
user_config.
|
|
151
|
+
user_config.port arg, Configuration.default_tcp_host
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
o.on "--pidfile PATH", "Use PATH as a pidfile" do |arg|
|