dalli 5.0.7 → 5.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10a8b21fed4728b6f98929e983262dc1fc32c59711fce78a84b0df82b0348ca1
4
- data.tar.gz: 0253d48293d3b482e8362830acd9323873302e202cb230bca3fc1b1e09b1b457
3
+ metadata.gz: da626a6bfcabdac3d5c8db15d06e6c567e7a302e6b479c2db3989d40a8e32d88
4
+ data.tar.gz: 1cdffab8886b14031f193af6e9dcd3cf26f463fc1612fb77c3ef2a8106ae41bf
5
5
  SHA512:
6
- metadata.gz: bda1d416cf1f88514d0181ed2e7f7b53e1b935fb07901398cb91183f63e42d0ab7c9e54c177264cf77fc793ead7b8183d79cf3c335d8dee11aae5049a6f0fff9
7
- data.tar.gz: d81bec09db2c23cdc95204b0bec5c491fbcb60e12823245b9d9d338502c98b2e6af5f6e58a12b11c081889ea5d63cb079b6e8ef2fb869db147f67219db86ac55
6
+ metadata.gz: 871db8e41047a834823c5c2c1caf9c4bc47265ea8b37e48f54673c7350b719e74c34d70ce27103cef4bf6acd6fba85786052ce05a9234ae6f3e98e1d30725f70
7
+ data.tar.gz: 02c5b3085ca382fd612629af79a2d06f4dc9d960f579623a8af57f2a8e4332343467e886a12e73abe3b6c52a38504896e88e2d133eace4ec6f07e0ae68af8727
data/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ Dalli Changelog
4
4
  Unreleased
5
5
  ==========
6
6
 
7
+ 5.0.8
8
+ ==========
9
+
10
+ Bug fixes:
11
+
12
+ - Fix multi-server `get_multi` stopping at an empty value (#1170)
13
+ - The pipelined reply parser took a hit on a zero-length value (`VA 0`) for the terminating `MN`, so that server's remaining keys were silently missing from the result
14
+ - Its value terminator and any replies not yet parsed stayed on the connection and were read as the replies to later commands on it. Those commands could fail with `Dalli::DalliError: Response error`, or a single-key `get` could silently return another key's value
15
+ - An empty value is now returned as `''`, like a single-key `get` and single-server `get_multi`
16
+ - Affects the meta protocol since 3.2.0 (the default since 5.0.0)
17
+ - Thanks to Julian Richard Contreras for this contribution
18
+
19
+ Development:
20
+
21
+ - Fix offenses reported by RuboCop 1.91 and require `rubocop >= 1.91` (backport of #1162)
22
+
7
23
  5.0.7
8
24
  ==========
9
25
 
data/Gemfile CHANGED
@@ -18,7 +18,7 @@ group :development, :test do
18
18
  gem 'rack', '~> 3'
19
19
  gem 'rack-session'
20
20
  gem 'rake', '~> 13.0'
21
- gem 'rubocop'
21
+ gem 'rubocop', '>= 1.91' # disable-next directives require 1.91+
22
22
  gem 'rubocop-minitest'
23
23
  gem 'rubocop-performance'
24
24
  gem 'rubocop-rake'
data/lib/dalli/client.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'digest/md5'
4
4
 
5
- # encoding: ascii
6
5
  module Dalli
7
6
  ##
8
7
  # Dalli::Client is the main class which developers will use to interact with
@@ -144,7 +143,7 @@ module Dalli
144
143
  # Fetch multiple keys efficiently.
145
144
  # If a block is given, yields key/value pairs one at a time.
146
145
  # Otherwise returns a hash of { 'key' => 'value', 'key2' => 'value1' }
147
- # rubocop:disable Style/ExplicitBlockArgument
146
+ # rubocop:disable-next Style/ExplicitBlockArgument
148
147
  def get_multi(*keys)
149
148
  keys.flatten!
150
149
  keys.compact!
@@ -156,7 +155,6 @@ module Dalli
156
155
  get_multi_hash(keys)
157
156
  end
158
157
  end
159
- # rubocop:enable Style/ExplicitBlockArgument
160
158
 
161
159
  ##
162
160
  # Fetch multiple keys efficiently, including available metadata such as CAS.
@@ -153,7 +153,7 @@ module Dalli
153
153
  response_processor.meta_set_append_prepend unless quiet?
154
154
  end
155
155
 
156
- # rubocop:disable Metrics/ParameterLists
156
+ # rubocop:disable-next Metrics/ParameterLists
157
157
  def write_append_prepend_req(mode, key, value, ttl = nil, cas = nil, _options = {})
158
158
  ttl = TtlSanitizer.sanitize(ttl) if ttl
159
159
  req = RequestFormatter.meta_set(key: key, value: value,
@@ -161,7 +161,6 @@ module Dalli
161
161
  write("#{req}#{value}#{TERMINATOR}")
162
162
  @connection_manager.flush unless quiet?
163
163
  end
164
- # rubocop:enable Metrics/ParameterLists
165
164
 
166
165
  # Delete Commands
167
166
  def delete(key, cas)
@@ -204,8 +204,10 @@ module Dalli
204
204
  # We have a complete response that has no body.
205
205
  # This is either the response to the terminating
206
206
  # noop or, if the status is not MN, an intermediate
207
- # error response that needs to be discarded.
208
- return [true, header_len] if body_len.zero?
207
+ # error response that needs to be discarded. A hit
208
+ # on an empty value (VA 0) still has a body -- just
209
+ # its terminator -- so it's parsed below as a value.
210
+ return [true, header_len] if body_len.zero? && tokens.first != VA
209
211
 
210
212
  resp_size = header_len + body_len + TERMINATOR.length
211
213
  # The header is in the buffer, but the body is not. As we don't have
data/lib/dalli/socket.rb CHANGED
@@ -124,7 +124,7 @@ module Dalli
124
124
  # Returns true for an unmodified TCPSocket on Ruby 3.0+, or for resolv-replace >= 0.2.0
125
125
  # which forwards keyword arguments through its patch.
126
126
  # Returns false when monkey-patched by gems like socksify or resolv-replace < 0.2.0.
127
- # rubocop:disable ThreadSafety/ClassInstanceVariable
127
+ # rubocop:disable-next ThreadSafety/ClassInstanceVariable
128
128
  def self.supports_connect_timeout?
129
129
  return @supports_connect_timeout if defined?(@supports_connect_timeout)
130
130
 
@@ -135,7 +135,6 @@ module Dalli
135
135
  end
136
136
  end
137
137
  end
138
- # rubocop:enable ThreadSafety/ClassInstanceVariable
139
138
 
140
139
  def self.create_socket_with_timeout(host, port, options)
141
140
  if supports_connect_timeout?
@@ -192,14 +191,13 @@ module Dalli
192
191
 
193
192
  # Detect and cache the correct pack format for struct timeval on this platform.
194
193
  # Different architectures have different sizes for time_t and suseconds_t.
195
- # rubocop:disable ThreadSafety/ClassInstanceVariable
194
+ # rubocop:disable-next ThreadSafety/ClassInstanceVariable
196
195
  def self.timeval_pack_format(sock)
197
196
  @timeval_pack_format ||= begin
198
197
  expected_size = sock.getsockopt(::Socket::SOL_SOCKET, ::Socket::SO_RCVTIMEO).data.bytesize
199
198
  TIMEVAL_PACK_FORMATS.find { |fmt| TIMEVAL_TEST_VALUES.pack(fmt).bytesize == expected_size } || 'll'
200
199
  end
201
200
  end
202
- # rubocop:enable ThreadSafety/ClassInstanceVariable
203
201
 
204
202
  def self.pack_timeval(sock, seconds, microseconds)
205
203
  [seconds, microseconds].pack(timeval_pack_format(sock))
data/lib/dalli/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dalli
4
- VERSION = '5.0.7'
4
+ VERSION = '5.0.8'
5
5
 
6
6
  MIN_SUPPORTED_MEMCACHED_VERSION = '1.6'
7
7
  end
@@ -16,11 +16,10 @@ module Rack
16
16
  attr_reader :data
17
17
 
18
18
  # Don't freeze this until we fix the specs/implementation
19
- # rubocop:disable Style/MutableConstant
19
+ # rubocop:disable-next Style/MutableConstant
20
20
  DEFAULT_DALLI_OPTIONS = {
21
21
  namespace: 'rack:session'
22
22
  }
23
- # rubocop:enable Style/MutableConstant
24
23
 
25
24
  # Brings in a new Rack::Session::Dalli middleware with the given
26
25
  # `:memcache_server`. The server is either a hostname, or a
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: 5.0.7
4
+ version: 5.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter M. Goldstein