Bugfix http-poll for correctly parsing binary (thanks to Peter Lemenkov)
authorBadlop <badlop@process-one.net>
Thu, 19 Aug 2010 15:37:21 +0000 (17:37 +0200)
committerBadlop <badlop@process-one.net>
Thu, 19 Aug 2010 15:38:38 +0000 (17:38 +0200)
src/web/ejabberd_http_poll.erl

index 0bdbc6287513e3897262383cbeb3940f02112591..faa0f3c1762263369be4ea2ccc68993e93d8aba1 100644 (file)
@@ -272,7 +272,13 @@ handle_event(_Event, StateName, StateData) ->
 %%          {stop, Reason, Reply, NewStateData}                    
 %%----------------------------------------------------------------------
 handle_sync_event({send, Packet}, _From, StateName, StateData) ->
-    Output = StateData#state.output ++ [lists:flatten(Packet)],
+    Packet2 = if
+                 is_binary(Packet) ->
+                     binary_to_list(Packet);
+                 true ->
+                     Packet
+             end,
+    Output = StateData#state.output ++ [lists:flatten(Packet2)],
     Reply = ok,
     {reply, Reply, StateName, StateData#state{output = Output}};