Forum: Ruby Re: HTTP IO??

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1c1e3bdfe006a22214102fcd6434a012?d=identicon&s=25 daniels (Guest)
on 2005-11-16 23:47
(Received via mailing list)
> 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.
#####################################################################################
4674615d2cf231975c741731be9a8685?d=identicon&s=25 ruby-talk (Guest)
on 2005-11-17 01:32
(Received via mailing list)
Daniel Sheppard 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
This topic is locked and can not be replied to.