Paul Lutus wrote:
> You mean, line by line? The socket class you are describing doesn't know
> about lines, it knows about blocks. So try this: read a block, split it
> into lines, do your processing. If you do this, you will discover some
> blocks end in the middle of a line. Then you will say, "Gee, maybe I should
> read the whole thing, then do the processing."
>
> At that point, you  will understand why the class is written as it is.

Class TCPSocket has both the methods each_line and readline. That isn't
the problem.

The issue with net/http is that it's an overly complicated API for
something that in most instances is very easy.

> Yep. Read the entire thing. Then process the result.

Not all network streams (or HTTP initiated transfers) ever finish. And
often the files will be too large to process that way - especially with
REXML
which is extremely memory hungry.

A better solution is to use openuri:
http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/

Or use a decent HTTP API instead of net/http.

Vidar