Re: HTTP IO?


#1

I am reading the stream from a Ogg stream server (VLC) in the
local machine.
This requires fast reading.

Are there any other options in ruby to read a data stream via HTTP??

Now that I know I know your use-case, definitely use openuri instead.
The only situations where you can’t use openuri is when you need finer
control over the headers (and the ability to read the response headers).
In your case, this doesn’t seem to be a problem.

Also, you can use the basic Net::HTTP to read chunked responses (which
I’m fairly sure would be used in a stream) - instead of calling
read_body on the response to get the entire body, pass a block to that
method - as each chunk is received, you’ll get it yielded to the method.
Not sure if this is useful in ogg decoding though - do you need to be
reading fixed lengthed strings from the stream or is it ok for the
length of each chunk to be arbitary?

#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################


#2

Daniel S. wrote:

control over the headers (and the ability to read the response headers).
In your case, this doesn’t seem to be a problem.

You also can only do GET requests with OpenURI. The Net::HTTPIO class
which has been discussed in this thread: it’s pathetic. Yes, it works
with MouseHole. But it’s a horrible hack. I am sure it is buggy.

A good man will one day come along and do it right. A man beloved by
his children, his wife, his close colleagues and social affiliates. But
most of all by me. Thankyou, future man, for all you do!

_why