net/websocket/frames.lua
changeset 13254 cfd062d025b0
parent 12978 ba409c67353b
equal deleted inserted replaced
13253:5884d58707fa 13254:cfd062d025b0
    75 
    75 
    76 	return result, header_length;
    76 	return result, header_length;
    77 end
    77 end
    78 
    78 
    79 -- XORs the string `str` with the array of bytes `key`
    79 -- XORs the string `str` with the array of bytes `key`
    80 -- TODO: optimize
       
    81 local function apply_mask(str, key, from, to)
    80 local function apply_mask(str, key, from, to)
    82 	return sxor(str:sub(from or 1, to or -1), key);
    81 	return sxor(str:sub(from or 1, to or -1), key);
    83 end
    82 end
    84 
    83 
    85 local function parse_frame_body(frame, header, pos)
    84 local function parse_frame_body(frame, header, pos)