Commit 888efc1b authored by antirez's avatar antirez
Browse files

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.
parent 26b6c697
...@@ -188,7 +188,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) { ...@@ -188,7 +188,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) {
int j = 0; int j = 0;
string2ll(reply+1,p-reply-1,&mbulklen); string2ll(reply+1,p-reply-1,&mbulklen);
if (server.lua_caller->resp == 2 || atype == '*') { if (server.lua_client->resp == 2 || atype == '*') {
p += 2; p += 2;
if (mbulklen == -1) { if (mbulklen == -1) {
lua_pushboolean(lua,0); lua_pushboolean(lua,0);
...@@ -200,7 +200,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) { ...@@ -200,7 +200,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) {
p = redisProtocolToLuaType(lua,p); p = redisProtocolToLuaType(lua,p);
lua_settable(lua,-3); 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 /* Here we handle only Set and Map replies in RESP3 mode, since arrays
* follow the above RESP2 code path. */ * follow the above RESP2 code path. */
p += 2; p += 2;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment