Http io?


#1

I am developing a streaming client in ruby, so far so good… now I am
trying
to get Net::HTTP to behave like an IO with no luck. I need Net::HTTP to
read
the headers as it usually does but stop at before reading the body of
the
page so I can read the stream in chunks and feed them to the player.

I read this article

http://redhanded.hobix.com/inspect/theStoryOfStreamingHttpThroughMouseholeWithSubsequentAdventuresInContinuationsAndDuckTyping.html

but I can’t get it to work.

any help is appreciated…

Horacio


#2

Horacio S. wrote:

I am developing a streaming client in ruby, so far so good… now I
am trying to get Net::HTTP to behave like an IO with no luck. I need
Net::HTTP to read the headers as it usually does but stop at before
reading the body of the page so I can read the stream in chunks and
feed them to the player.

I read this article

http://redhanded.hobix.com/inspect/theStoryOfStreamingHttpThroughMouseholeWithSubsequentAdventuresInContinuationsAndDuckTyping.html

but I can’t get it to work.

any help is appreciated…

open-uri can help you - although you won’t see headers

require ‘open-uri’
=> true

open(“http://www.google.com/index.html”) {|io| p io.read }

Kind regards

robert