dalli 3.2.7 → 3.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a98f25c5f6f750d72b83fdd0b6e45a9d693520a91b9b7d985bd26fd0abfac41e
4
- data.tar.gz: 9e95098e69ece841757034d69cc2091e0b450feed17290bf5fffd527e6d45ac7
3
+ metadata.gz: c7d8b3dd9e76a224d876f901dc44c3cf8016326209df3efc7fe522053a4a3c22
4
+ data.tar.gz: 0ced058a6a170cadd4b74268de5417c4a1e700baf5767fc8f260db9477e2b735
5
5
  SHA512:
6
- metadata.gz: 25368bee67a5fd00aa7795cc06839c366fb7c1c33386ca0304c1cdfee3a4c82729716128d8f452cb7e0c0e2c24e2c3aec384eb7e3e0ee68c3915d93e17917456
7
- data.tar.gz: f0094059b3e7430b3b03a0a6d8795ba0e76bdf1622ba2531b3ceffa11ebb3fb2442a4512a5c98e27e00fba253a7241fb58f47e3f93c58944676c8cd5d0dfe123
6
+ metadata.gz: 3e316a4d60c3327cecec46a0a34c52536130199124035c375bf1933676d85fbf09e99a985ae44faf4e27b0fb1f8b8faef1656a812e6bdfc387406c5e18874461
7
+ data.tar.gz: bce3e0e41c280e99889bea6835c1b2f701cbcb5e4f398203ae2b4d6ebc05cdc505ee5955365715f8e00441d69701ceac84de37a98eac8581d003d1ab411a33e9
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ Dalli Changelog
4
4
  Unreleased
5
5
  ==========
6
6
 
7
+ 3.2.8
8
+ ==========
9
+
10
+ - Handle IO::TimeoutError when establishing connection (eugeneius)
11
+ - Drop dependency on base64 gem (Earlopain)
12
+ - Address incompatibility with resolv-replace (y9v)
13
+ - Add rubygems.org metadata (m-nakamura145)
14
+
7
15
  3.2.7
8
16
  ==========
9
17
 
@@ -55,7 +55,7 @@ module Dalli
55
55
  @sock = memcached_socket
56
56
  @pid = PIDCache.pid
57
57
  @request_in_progress = false
58
- rescue SystemCallError, Timeout::Error, EOFError, SocketError => e
58
+ rescue SystemCallError, *TIMEOUT_ERRORS, EOFError, SocketError => e
59
59
  # SocketError = DNS resolution failure
60
60
  error_on_request!(e)
61
61
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'base64'
4
-
5
3
  module Dalli
6
4
  module Protocol
7
5
  class Meta
@@ -17,13 +15,15 @@ module Dalli
17
15
  def self.encode(key)
18
16
  return [key, false] if key.ascii_only? && !WHITESPACE.match(key)
19
17
 
20
- [Base64.strict_encode64(key), true]
18
+ strict_base64_encoded = [key].pack('m0')
19
+ [strict_base64_encoded, true]
21
20
  end
22
21
 
23
22
  def self.decode(encoded_key, base64_encoded)
24
23
  return encoded_key unless base64_encoded
25
24
 
26
- Base64.strict_decode64(encoded_key).force_encoding(Encoding::UTF_8)
25
+ strict_base64_decoded = encoded_key.unpack1('m0')
26
+ strict_base64_decoded.force_encoding(Encoding::UTF_8)
27
27
  end
28
28
  end
29
29
  end
data/lib/dalli/socket.rb CHANGED
@@ -88,22 +88,30 @@ module Dalli
88
88
  # options - supports enhanced logging in the case of a timeout
89
89
  attr_accessor :options
90
90
 
91
- if RUBY_VERSION >= '3.0'
92
- def self.open(host, port, options = {})
93
- sock = new(host, port, connect_timeout: options[:socket_timeout])
91
+ def self.open(host, port, options = {})
92
+ create_socket_with_timeout(host, port, options) do |sock|
94
93
  sock.options = { host: host, port: port }.merge(options)
95
94
  init_socket_options(sock, options)
96
95
 
97
96
  options[:ssl_context] ? wrapping_ssl_socket(sock, host, options[:ssl_context]) : sock
98
97
  end
99
- else
100
- def self.open(host, port, options = {})
98
+ end
99
+
100
+ def self.create_socket_with_timeout(host, port, options)
101
+ # Check that TCPSocket#initialize was not overwritten by resolv-replace gem
102
+ # (part of ruby standard library since 3.0.0, should be removed in 3.4.0),
103
+ # as it does not handle keyword arguments correctly.
104
+ # To check this we are using the fact that resolv-replace
105
+ # aliases TCPSocket#initialize method to #original_resolv_initialize.
106
+ # https://github.com/ruby/resolv-replace/blob/v0.1.1/lib/resolv-replace.rb#L21
107
+ if RUBY_VERSION >= '3.0' &&
108
+ !::TCPSocket.private_instance_methods.include?(:original_resolv_initialize)
109
+ sock = new(host, port, connect_timeout: options[:socket_timeout])
110
+ yield(sock)
111
+ else
101
112
  Timeout.timeout(options[:socket_timeout]) do
102
113
  sock = new(host, port)
103
- sock.options = { host: host, port: port }.merge(options)
104
- init_socket_options(sock, options)
105
-
106
- options[:ssl_context] ? wrapping_ssl_socket(sock, host, options[:ssl_context]) : sock
114
+ yield(sock)
107
115
  end
108
116
  end
109
117
  end
data/lib/dalli/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dalli
4
- VERSION = '3.2.7'
4
+ VERSION = '3.2.8'
5
5
 
6
6
  MIN_SUPPORTED_MEMCACHED_VERSION = '1.4'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dalli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.7
4
+ version: 3.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter M. Goldstein
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-28 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: base64
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
12
+ date: 2024-02-12 00:00:00.000000000 Z
13
+ dependencies: []
28
14
  description: High performance memcached client for Ruby
29
15
  email:
30
16
  - peter.m.goldstein@gmail.com
@@ -73,6 +59,8 @@ homepage: https://github.com/petergoldstein/dalli
73
59
  licenses:
74
60
  - MIT
75
61
  metadata:
62
+ bug_tracker_uri: https://github.com/petergoldstein/dalli/issues
63
+ changelog_uri: https://github.com/petergoldstein/dalli/blob/main/CHANGELOG.md
76
64
  rubygems_mfa_required: 'true'
77
65
  post_install_message:
78
66
  rdoc_options: []
@@ -89,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
77
  - !ruby/object:Gem::Version
90
78
  version: '0'
91
79
  requirements: []
92
- rubygems_version: 3.5.5
80
+ rubygems_version: 3.5.6
93
81
  signing_key:
94
82
  specification_version: 4
95
83
  summary: High performance memcached client for Ruby