gomemcache icon indicating copy to clipboard operation
gomemcache copied to clipboard

whitespace key is not allowed when reading an existing key from memcached

Open farshidce opened this issue 7 years ago • 1 comments

is there a reason why legalKey function returns False if the binary key has whitespace character ?

having a key with whitespace is not an issue when using `python-binary-memcached in spite of https://github.com/memcached/memcached/blob/95e6469bd2ceef92bcaaf140e2724fc73d556185/doc/protocol.txt#L49.

for instance I am able to set and retrieve a binary key ((' \u039b\ufffd\ufffd#\ufffdm')) or (' ��#�m') from python but unable to read this key using gomemcache due to this check : https://github.com/bradfitz/gomemcache/blob/1952afaa557dc08e8e0d89eafab110fb501c1a2b/memcache/memcache.go#L95

python code:

from bmemcached import Client
client.set(' \u039b\ufffd\ufffd#\ufffdm', "sample value")
print(client.get(' \u039b\ufffd\ufffd#\ufffdm'))

Go

mc.Get(" \u039b\ufffd\ufffd#\ufffdm")

farshidce avatar Apr 15 '18 05:04 farshidce

According to the Protocol standard (https://github.com/memcached/memcached/wiki/Commands#standard-protocol):

A key (arbitrary string up to 250 bytes in length. No space or newlines for ASCII mode)

seems like it's not an issue

victor-perov avatar Dec 04 '19 17:12 victor-perov