From 888efc1b3642959b05815473663a5f0971af53ac Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 13 Sep 2019 19:38:35 +0200 Subject: [PATCH] RESP3: Lua parsing should depend on lua client, not lua caller. We want all the scripts to run in RESP2 mode by default. It's up to the caller to switch to V3 using redis.setresp() if it is really needed. This way most scripts written for past Redis versions will continue to work with Redis >= 6 even if the client is in RESP3 mode. --- src/scripting.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripting.c b/src/scripting.c index 68c7ce006..ee37ac23f 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -188,7 +188,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) { int j = 0; string2ll(reply+1,p-reply-1,&mbulklen); - if (server.lua_caller->resp == 2 || atype == '*') { + if (server.lua_client->resp == 2 || atype == '*') { p += 2; if (mbulklen == -1) { lua_pushboolean(lua,0); @@ -200,7 +200,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) { p = redisProtocolToLuaType(lua,p); lua_settable(lua,-3); } - } else if (server.lua_caller->resp == 3) { + } else if (server.lua_client->resp == 3) { /* Here we handle only Set and Map replies in RESP3 mode, since arrays * follow the above RESP2 code path. */ p += 2;