def each_line(eol=$/)
if (@ready_to_read) then
each_body do |messg|
@line_buf << messg
while (pos = @line_buf.index(eol))
line = @line_buf[0...(pos + eol.length)]
@line_buf = @line_buf[(pos + eol.length)..-1]
yield(line)
end
end
end
if (@line_buf) then
unless (@line_buf.empty?) then
while (pos = @line_buf.index(eol))
line = @line_buf[0...(pos + eol.length)]
@line_buf = @line_buf[(pos + eol.length)..-1]
yield(line)
end
unless (@line_buf.empty?) then
yield(@line_buf)
end
end
@line_buf = nil
else
raise 'failed to read a request message body.'
end
nil
end