1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Update code files

1. mini_sll.c - add SSL version info
2. RuboCop fixes
3. control_cli.rb stability
This commit is contained in:
MSP-Greg 2018-08-21 20:10:02 -05:00 committed by MSP-Greg
parent 6a7112d51b
commit a3ac7b9c27
4 changed files with 23 additions and 11 deletions

View file

@ -433,6 +433,18 @@ void Init_mini_ssl(VALUE puma) {
mod = rb_define_module_under(puma, "MiniSSL");
eng = rb_define_class_under(mod, "Engine", rb_cObject);
// OpenSSL Build / Runtime/Load versions
/* Version of OpenSSL that Puma was compiled with */
rb_define_const(mod, "OPENSSL_VERSION", rb_str_new2(OPENSSL_VERSION_TEXT));
#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000
/* Version of OpenSSL that Puma loaded with */
rb_define_const(mod, "OPENSSL_LIBRARY_VERSION", rb_str_new2(OpenSSL_version(OPENSSL_VERSION)));
#else
rb_define_const(mod, "OPENSSL_LIBRARY_VERSION", rb_str_new2(SSLeay_version(SSLEAY_VERSION)));
#endif
rb_define_singleton_method(mod, "check", noop, 0);
eError = rb_define_class_under(mod, "SSLError", rb_eStandardError);

View file

@ -1,8 +1,8 @@
require 'optparse'
require 'puma/state_file'
require 'puma/const'
require 'puma/detect'
require 'puma/configuration'
require_relative 'state_file'
require_relative 'const'
require_relative 'detect'
require_relative 'configuration'
require 'uri'
require 'socket'
@ -129,7 +129,7 @@ module Puma
uri = URI.parse @control_url
# create server object by scheme
@server = case uri.scheme
server = case uri.scheme
when "tcp"
TCPSocket.new uri.host, uri.port
when "unix"
@ -147,9 +147,9 @@ module Puma
url = url + "?token=#{@control_auth_token}"
end
@server << "GET #{url} HTTP/1.0\r\n\r\n"
server << "GET #{url} HTTP/1.0\r\n\r\n"
unless data = @server.read
unless data = server.read
raise "Server closed connection before responding"
end
@ -172,8 +172,8 @@ module Puma
message "Command #{@command} sent success"
message response.last if @command == "stats" || @command == "gc-stats"
end
@server.close
ensure
server.close if server && !server.closed?
end
def send_signal

View file

@ -493,7 +493,7 @@ module Puma
when Hash
if hdr = val[:header]
@options[:remote_address] = :header
@options[:remote_address_header] = "HTTP_" + hdr.upcase.gsub("-", "_")
@options[:remote_address_header] = "HTTP_" + hdr.upcase.tr("-", "_")
else
raise "Invalid value for set_remote_address - #{val.inspect}"
end

View file

@ -110,7 +110,7 @@ module Puma::Rack
has_options = false
server.valid_options.each do |name, description|
next if name.to_s.match(/^(Host|Port)[^a-zA-Z]/) # ignore handler's host and port options, we do our own.
next if name.to_s =~/^(Host|Port)[^a-zA-Z]/ # ignore handler's host and port options, we do our own.
info << " -O %-21s %s" % [name, description]
has_options = true
end