Skip to content

Commit

Permalink
require Ruby 2.6 or later
Browse files Browse the repository at this point in the history
Drop support for Ruby 2.3, 2.4, and 2.5.

As of 2021-10, Ruby 2.6 is the oldest version that still receives
security fixes from the Ruby core team, so it doesn't make much sense
to keep code for those ancient versions.
  • Loading branch information
rhenium committed Oct 16, 2021
1 parent baa83a8 commit 3436bd0
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
ruby: [ head, "3.0", "2.7", "2.6", "2.5", "2.4", "2.3" ]
ruby: [ head, "3.0", "2.7", "2.6" ]
steps:
- name: repo checkout
uses: actions/checkout@v2
Expand All @@ -38,7 +38,7 @@ jobs:
fail-fast: false
matrix:
os: [ windows-latest ]
ruby: [ mswin, mingw, "3.0", "2.7", "2.6", "2.5", "2.4", "2.3" ]
ruby: [ mswin, mingw, "3.0", "2.7", "2.6" ]
steps:
- name: repo checkout
uses: actions/checkout@v2
Expand Down
1 change: 0 additions & 1 deletion ext/openssl/ossl.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ void ossl_debug(const char *, ...);
* Include all parts
*/
#include "openssl_missing.h"
#include "ruby_missing.h"
#include "ossl_asn1.h"
#include "ossl_bio.h"
#include "ossl_bn.h"
Expand Down
3 changes: 0 additions & 3 deletions ext/openssl/ossl_pkey_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,6 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
ossl_raise(rb_eArgError, "wrong number of arguments");
}

#if !defined(LIKELY) && !defined(RB_LIKELY)
#define LIKELY(x) (x)
#endif
ASSUME(group);
RTYPEDDATA_DATA(self) = group;

Expand Down
24 changes: 0 additions & 24 deletions ext/openssl/ruby_missing.h

This file was deleted.

12 changes: 1 addition & 11 deletions lib/openssl/buffering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ def consume_rbuff(size=nil)
end
end

if "".respond_to?(:unpack1)
def unpack_byte(str)
str.unpack1("C")
end
else
def unpack_byte(str)
str.unpack("C").first
end
end

public

# call-seq:
Expand All @@ -117,7 +107,7 @@ def unpack_byte(str)
# Get the next 8bit byte from `ssl`. Returns `nil` on EOF
def getbyte
byte = read(1)
byte && unpack_byte(byte)
byte && byte.unpack1("C")
end

##
Expand Down
2 changes: 1 addition & 1 deletion openssl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
spec.extra_rdoc_files = Dir["*.md"]
spec.rdoc_options = ["--main", "README.md"]

spec.required_ruby_version = ">= 2.3.0"
spec.required_ruby_version = ">= 2.6.0"

spec.metadata["msys2_mingw_dependencies"] = "openssl"
end
12 changes: 3 additions & 9 deletions test/openssl/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ def start_server(verify_mode: OpenSSL::SSL::VERIFY_NONE, start_immediately: true
threads = []
begin
server_thread = Thread.new do
if Thread.method_defined?(:report_on_exception=) # Ruby >= 2.4
Thread.current.report_on_exception = false
end
Thread.current.report_on_exception = false

begin
loop do
Expand All @@ -254,9 +252,7 @@ def start_server(verify_mode: OpenSSL::SSL::VERIFY_NONE, start_immediately: true
end

th = Thread.new do
if Thread.method_defined?(:report_on_exception=)
Thread.current.report_on_exception = false
end
Thread.current.report_on_exception = false

begin
server_proc.call(ctx, ssl)
Expand All @@ -273,9 +269,7 @@ def start_server(verify_mode: OpenSSL::SSL::VERIFY_NONE, start_immediately: true
end

client_thread = Thread.new do
if Thread.method_defined?(:report_on_exception=)
Thread.current.report_on_exception = false
end
Thread.current.report_on_exception = false

begin
block.call(port)
Expand Down

0 comments on commit 3436bd0

Please sign in to comment.