Spaces in memcache keynames

Bug #794456 reported by cpaetzel on 2011-06-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python Memcached
Undecided
Sean Reifschneider

Bug Description

On line 956 of memcache.py, test for control characters should be <32, not <33, as ASCII 32 is space:

In [8]: c.set("foo bar", "baz")
---------------------------------------------------------------------------
MemcachedKeyCharacterError Traceback (most recent call last)

/x/<ipython console> in <module>()

/x/python/lib/python2.7/site-packages/python_memcached-1.47-py2.7.egg/memcache.pyc in set(self, key, val, time, min_compress_len)
    523 indicating don't ever try to compress.
    524 '''
--> 525 return self._set("set", key, val, time, min_compress_len)
    526
    527

/x/python/lib/python2.7/site-packages/python_memcached-1.47-py2.7.egg/memcache.pyc in _set(self, cmd, key, val, time, min_compress_len)
    730
    731 def _set(self, cmd, key, val, time, min_compress_len = 0):
--> 732 self.check_key(key)
    733 server, key = self._get_server(key)
    734 if not server:

/x/python/lib/python2.7/site-packages/python_memcached-1.47-py2.7.egg/memcache.pyc in check_key(self, key, key_extra_len)
    956 if ord(char) < 33 or ord(char) == 127:
    957 raise Client.MemcachedKeyCharacterError(
--> 958 "Control characters not allowed")
    959
    960

MemcachedKeyCharacterError: Control characters not allowed

Sean Reifschneider (jafo) wrote :

Seems reasonable to me, change committed in r46.

Changed in python-memcached:
assignee: nobody → Sean Reifschneider (jafo)
status: New → Fix Committed
Sean Reifschneider (jafo) wrote :

Sorry, I've had to revert this change as it looks like the memcached server fails if there are spaces, and this change was causing the tests to fail. Also, are you sure that the memcached protocol even supports spaces in keys? Space is the character that memcached uses for separating fields in the protocol.

Changed in python-memcached:
status: Fix Committed → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers