diff --git a/lib/websocket/http/headers.rb b/lib/websocket/http/headers.rb index cfe937c..135a8d8 100644 --- a/lib/websocket/http/headers.rb +++ b/lib/websocket/http/headers.rb @@ -55,8 +55,10 @@ def error? def parse(chunk) chunk.each_byte do |octet| - @size += 1 - return error if @size > MAX_REQUEST_SIZE + if @stage < 2 + @size += 1 + return error if @size > MAX_REQUEST_SIZE + end if octet == LF and @stage < 2 @buffer.pop if @buffer.last == CR