Add cfw_stream_read_line().

This also adds a caching infrastructure to cfw_stream.