class Protocol::HTTP::Body::Readable

def each

@parameter chunk [String | Nil] The chunk of data, or `nil` if the stream has finished.
@yields {|chunk| ...} The block to call with each chunk of data.

Closes the stream when finished or if an error occurs.

Enumerate all chunks until finished, then invoke {close}.
def each
	return to_enum unless block_given?
	
	begin
		while chunk = self.read
			yield chunk
		end
	rescue => error
		raise
	ensure
		self.close(error)
	end
end