Skip to main content
Topic: Using readers (Read 2658 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using readers

I'm currently trying to play with some idea for a plugin, and it needs to retrieve data via http protocol (GET method). Can I use existing http_reader to perform this operation?

If the answer is yes, then how can I do that? How to check if http reader is installed and (generally) how to use readers?

TIA for any help.

Using readers

Reply #1
reader * p_reader = file::g_open("http://blah.com/meh.php",reader::MODE_READ);
if (p_reader)
{
p_reader->read(blah,meh);
p_reader->reader_release();
}

Using readers

Reply #2
Ah, thanks! That's easier than I thougt 

Using readers

Reply #3
Is there any way to modify headers sent by http_reader?

freedb servers i tried seem to assume "Connection: Keep-alive", and retrieving data from them takes ages (~15 seconds). I modified http_reader code to see what happens if "Connection: close" header is sent, and all GETs became blazing fast. It would be nice to find some workaround with unmodified http_reader...

Using readers

Reply #4
OK, I circumvented this problem by implementing my own reader based on original foo_http_read, but I just wanted you to know that the same problem applies to remote *.pls reading (foobar unnecessarily stalls for ~15 seconds when you drop any url from, let's say, shoutcast.com).

 
SimplePortal 1.0.0 RC1 © 2008-2019