24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-30 23:02:00 +02:00

Don't try to decode utf-8 codepoints in ej_websocket only to convert it back to utf-8 in ej_http_ws

Additionally that conversion code was wrong sometimes and lead to loosing
some bits of information.

This fixes EJABS-1875
This commit is contained in:
Paweł Chmielowski 2012-09-14 10:20:33 +02:00
parent 8eef2f02bf
commit 975f4c56d4
2 changed files with 3 additions and 4 deletions

View File

@ -143,13 +143,12 @@ handle_sync_event(close, _From, _StateName, StateData) ->
handle_info(closed, _StateName, StateData) ->
{stop, normal, StateData};
handle_info({browser, Packet}, StateName, StateData) ->
NPacket = unicode:characters_to_binary(Packet, latin1),
NewState = case StateData#state.waiting_input of
false ->
Input = <<(StateData#state.input)/binary, NPacket/binary>>,
Input = <<(StateData#state.input)/binary, Packet/binary>>,
StateData#state{input = Input};
Receiver ->
Receiver ! {tcp, StateData#state.socket, NPacket},
Receiver ! {tcp, StateData#state.socket, Packet},
cancel_timer(StateData#state.timer),
Timer = erlang:start_timer(StateData#state.timeout,
self(), []),

View File

@ -360,7 +360,7 @@ process_hixie_68({_, L}, <<255, T/binary>>) ->
{L2, Recv, Send} = process_hixie_68({false, <<>>}, T),
{L2, [L | Recv], Send};
process_hixie_68({true, L}, <<H/utf8, T/binary>>) ->
process_hixie_68({true, <<L/binary, H>>}, T).
process_hixie_68({true, <<L/binary, H/utf8>>}, T).
-record(hybi_8_state,
{mask = none, offset = 0, left, final_frame = true,