Skip to content

Commit 7a3f41b

Browse files
committed
backwards compatible to very old ruby
1 parent 2ae371f commit 7a3f41b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/net/smtp.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,8 @@ def finish
660660

661661
private
662662

663-
def tcp_socket(address, port, **kwargs)
664-
TCPSocket.open(address, port, **kwargs)
663+
def tcp_socket(*args, **kwargs)
664+
TCPSocket.open(*args, **kwargs)
665665
end
666666

667667
def do_start(helo_domain, user, secret, authtype)
@@ -674,11 +674,11 @@ def do_start(helo_domain, user, secret, authtype)
674674
case @tcp_socket_supports_open_timeout
675675
when nil, true
676676
begin
677-
sock = tcp_socket(@address, @port, open_timeout: @open_timeout)
677+
sock = tcp_socket(@address, @port, nil, nil, open_timeout: @open_timeout)
678678
@tcp_socket_supports_open_timeout = true
679679
sock
680680
rescue ArgumentError => e
681-
raise unless e.message.include?('unknown keyword: :open_timeout') || e.message.include?('wrong number of arguments')
681+
raise unless e.message.include?('unknown keyword: :open_timeout') || e.message.include?('wrong number of arguments (given 5, expected 2..4)')
682682
@tcp_socket_supports_open_timeout = false
683683

684684
Timeout.timeout(@open_timeout, Net::OpenTimeout) do

test/net/smtp/test_sslcontext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def initialize(socket, **kw)
2121
super("localhost", **kw)
2222
end
2323

24-
def tcp_socket(*, **)
24+
def tcp_socket(*args, **kwargs)
2525
@fake_socket
2626
end
2727

test/net/smtp/test_starttls.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def initialize(socket)
1414
super("smtp.example.com")
1515
end
1616

17-
def tcp_socket(*, **)
17+
def tcp_socket(*args, **kwargs)
1818
@fake_socket
1919
end
2020

0 commit comments

Comments
 (0)