spymemcached.jruby 1.0.4-java → 1.0.5-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spymemcached.rb +2 -2
- data/test/spymemcached_test.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6edd4c7d3f8e0da507d7fe7f7a2c4a0b2414c3
|
4
|
+
data.tar.gz: fbf5f5f14abae86a2a5927c1057387aacfbd293f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e58ff82da3526ba9f34bf83c8cf2c355f4ddb2e7e4dc85617b66850c805b16a4576ae88a8651731eddc572723d5a296b32d9d6bbf955b34ccdfd1786231a28a
|
7
|
+
data.tar.gz: 208a5a87e1887c8c35688ca8678a63f37888ef75146909f4c45b951abe4c7767dd5703b522ce366bf72bdae530c8b4454202dbaa7b1dc30c22416f240eecd666
|
data/lib/spymemcached.rb
CHANGED
@@ -140,8 +140,8 @@ class Spymemcached
|
|
140
140
|
# characters properly.
|
141
141
|
def escape_key(key)
|
142
142
|
key = key.to_s.dup
|
143
|
-
key = key.force_encoding(Encoding::ASCII_8BIT)
|
144
|
-
key = key.gsub(ESCAPE_KEY_CHARS){ |match| "%#{match.
|
143
|
+
key = key.force_encoding(Encoding::ASCII_8BIT) if defined?(Encoding)
|
144
|
+
key = key.gsub(ESCAPE_KEY_CHARS){ |match| "%#{match.bytes.to_a[0].to_s(16).upcase}" }
|
145
145
|
key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250
|
146
146
|
key
|
147
147
|
end
|
data/test/spymemcached_test.rb
CHANGED
@@ -174,7 +174,15 @@ class SpymemcachedTest < Test::Unit::TestCase
|
|
174
174
|
assert_match(/\d\.\d+\.\d+/, v.values.first)
|
175
175
|
end
|
176
176
|
|
177
|
-
def
|
177
|
+
def test_handles_invalid_key_and_utf8_chars
|
178
|
+
k = 'k 开'
|
179
|
+
@client.add(k, 'v1')
|
180
|
+
assert_equal('v1', @client.get(k))
|
181
|
+
@client.set(k, 'v2')
|
182
|
+
assert_equal({k => 'v2'}, @client.get_multi(k))
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_handles_long_string_key
|
178
186
|
k = 'k 开' * 250
|
179
187
|
@client.add(k, 'v1')
|
180
188
|
assert_equal('v1', @client.get(k))
|