Permalink
Browse files

Fix multibulk responses containing empty strings

Empty strings aren't nil.  Stop pretending they are.  Stop
throwing away all my data because one response string is empty.
  • Loading branch information...
1 parent 7270366 commit 912b7d0ac39b7c602f86788d4448520f9b768090 @mattsta mattsta committed May 31, 2010
Showing with 447 additions and 4 deletions.
  1. +4 −4 src/erldis_client.erl
  2. +443 −0 src/tags
View
@@ -407,7 +407,7 @@ send_reply(State) ->
parse_state(State, Socket, Data) ->
Parse = erldis_proto:parse(State#redis.pstate, trim2(Data)),
-
+% error_logger:error_msg({trimmed, trim2(Data), parsed, Parse}),
case {State#redis.remaining-1, Parse} of
{0, error} ->
% next line is the error string
@@ -432,9 +432,9 @@ parse_state(State, Socket, Data) ->
_ -> NewState
end
end;
- {_, {read, 0}} ->
- % reply with nil
- send_reply(State#redis{buffer=[]});
+ {_, {read, 0}} when State#redis.pstate =:= empty ->
+ % this is needed to handle single-line reply empty responses
+ send_reply(State#redis{buffer=[]});
{0, {read, NBytes}} ->
% reply with Value added to buffer
Value = recv_value(Socket, NBytes),
Oops, something went wrong.

0 comments on commit 912b7d0

Please sign in to comment.