From 87d2e51b980627c645893d5c115bb0d9c132911f Mon Sep 17 00:00:00 2001 From: Date: Fri, 9 Jan 2009 11:21:54 +0200 Subject: [PATCH] Change binary protocol behavior to disallow the use of key verification. (We disable key verification in case setting binary-protocol behavior, and disallow setting key verification behavior in case binary protocol is already in use. Motivation for this is to allow the use of arbitrary key content i.e. non-ascii --- libmemcached/memcached_behavior.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libmemcached/memcached_behavior.c b/libmemcached/memcached_behavior.c index 5f688440..fc785e25 100644 --- a/libmemcached/memcached_behavior.c +++ b/libmemcached/memcached_behavior.c @@ -40,6 +40,8 @@ memcached_return memcached_behavior_set(memcached_st *ptr, ptr->server_failure_limit= (uint32_t)data; break; case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL: + if (data) + set_behavior_flag(ptr, MEM_VERIFY_KEY, 0); set_behavior_flag(ptr, MEM_BINARY_PROTOCOL, data); break; case MEMCACHED_BEHAVIOR_SUPPORT_CAS: @@ -101,6 +103,8 @@ memcached_return memcached_behavior_set(memcached_st *ptr, memcached_quit(ptr); break; case MEMCACHED_BEHAVIOR_VERIFY_KEY: + if (ptr->flags & MEM_BINARY_PROTOCOL) + break; set_behavior_flag(ptr, MEM_VERIFY_KEY, data); break; case MEMCACHED_BEHAVIOR_SORT_HOSTS: -- 2.30.2