From: Daniel DeLorme Date: 2007-01-22T16:09:27+09:00 Subject: Re: Reading an HTTPResponse line by line Scara Maccai wrote: > Ok, but that's what I did in the first place, but it doesn't allow > reading line by line... that is, it looks to me that you can > > 1) reading as chunks come in > > OR > > 2) reading line by line > > but you can't > > "reading lines as they come in..." chunks are made out of lines; it's not so difficult to process each line as the chunks come in: buffer = "" req = Net::HTTP.new('10.2.1.2') req.post('/mycgi', mydata) do |chunk| buffer << chunk while buffer.sub!(/^(.*)\n/,"") do_something_with_line($1) end end Daniel