Scara Maccai
1/19/2007 8:26:00 AM
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..."
(that is, 1) AND 2) as it would be the case with
"BufferedReader.readLine()" in Java).
In other words what I wanted is (pseudo-code):
response_handler = get_response_handler
while( line = response_handler.getLine())
{
doSomethingWith(line)
}
without having to wait for the whole response to be read before starting
parsing...
> just give the post method a block. for instance, although google doesn't
> allow posting to this url
>
> harp:~ > cat a.rb
> require 'net/http'
>
> Net::HTTP.start 'fortytwo.merseine.nu', 80 do |http|
> http.post '/form.cgi', 'k=v&a=42' do |chunk|
> puts chunk
> end
> end
>
>
> harp:~ > ruby a.rb
> ---
> k:
> - v
> a:
> - "42"
>
>
> -a