From e9002f21117df8468c7f1bf3a63e8a86607b63f2 Mon Sep 17 00:00:00 2001 From: "roberto@mmaverick64" Date: Thu, 10 Feb 2011 15:07:46 +0100 Subject: [PATCH] allow empty string in cache python api --- plugins/python/uwsgi_pymodule.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 4eb51e22..f4a40fa7 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -2364,7 +2364,7 @@ PyObject *py_uwsgi_cache_del(PyObject * self, PyObject * args) { return NULL; } - if (remote) { + if (remote && strlen(remote) > 0) { uwsgi_simple_send_string(remote, 111, 2, key, keylen, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]); } else if (uwsgi.cache_max_items) { @@ -2398,7 +2398,7 @@ PyObject *py_uwsgi_cache_set(PyObject * self, PyObject * args) { return PyErr_Format(PyExc_ValueError, "uWSGI cache items size must be < 64K, requested %d bytes", (int) vallen); } - if (remote) { + if (remote && strlen(remote) > 0) { uwsgi_simple_send_string2(remote, 111, 1, key, keylen, value, vallen, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]); } else if (uwsgi.cache_max_items) { @@ -2445,7 +2445,7 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) { return NULL; } - if (remote) { + if (remote && strlen(remote) > 0) { uwsgi_simple_message_string(remote, 111, 0, key, keylen, buffer, &valsize, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]); if (valsize > 0) { value = buffer;