module WebSocket::HTTP::Headers
def parse(chunk)
def parse(chunk) chunk.each_byte do |octet| if octet == LF and @stage < 2 @buffer.pop if @buffer.last == CR if @buffer.empty? complete if @stage == 1 else result = case @stage when 0 then start_line(string_buffer) when 1 then header_line(string_buffer) end if result @stage = 1 else error end end @buffer = [] else @buffer << octet if @stage >= 0 error if @stage < 2 and @buffer.size > MAX_LINE_LENGTH end end @env['rack.input'] = StringIO.new(string_buffer) end