lua parser and redis2 questions

agentzh agentzh at gmail.com
Mon Jun 6 12:10:31 MSD 2011


On Mon, Jun 6, 2011 at 6:40 AM, gregr401 <nginx-forum at nginx.us> wrote:
> Thanks, logar.  I mimicked your test config and the below is the
> result:
>
>
> location /testluaparser {
>                content_by_lua '
>                     local replies = ngx.location.capture("/redis2")
>                     local parser = require("redis.parser")
>                     ngx.say("reply status is:",replies.status)
>                     ngx.say("reply body is:",replies.body)
>                     ngx.say("end of showresults")
>                     local res,typ = parser.parse_reply(replies.body)

You should have used the parse_replies function instead. The
parse_reply function always tries to parse only one single redis
command reply.

>                     ngx.say("type=", typ)
>                     ngx.say("res=", res)
>                ';
> }
>
> reply status is:200
> reply body is:$11
> auth is off
> $3
> bar
>
> end of showresults
> type=4
> res=auth is off
>

Your output indeed indicates that only the first redis reply is parsed ;)

Try lua-redis-parser v0.05 instead, as suggested in my another mail in
this thread.

Good luck!
-agentzh



More information about the nginx mailing list