PDA

View Full Version : Non-blocking web requests



mherger
2005-02-23, 04:37
Dan

Your following code does always return the "timeout". What's wrong with it?

# This makes a non-blocking request to the remote server.
my $http = Slim::Player::Source::openRemoteStream($searchURL, undef,
$request) || return 'timeout?';
my $html = $http->content();
$http->close();

Hmm... looking at Slim::Player::Source I saw that openRemotStream does not
accept a third parameter?!?

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

Dan Sully
2005-02-23, 11:04
* Michael Herger shaped the electrons to say...

>Your following code does always return the "timeout". What's wrong with it?

Michael - I've updated this code a bit. If you're only using HTTP, it's best
to go directly to the protocol handler, as you'll have more control that way.

Take a look at the RSS module. You'll probably want 'create' => 0,

Let me know if this is still giving you headaches.

-D
--
<iNoah> all your base class are belong to us

mherger
2005-02-23, 14:22
On Wed, 23 Feb 2005 10:04:49 -0800, Dan Sully <dan (AT) slimdevices (DOT) com> wrote:

> * Michael Herger shaped the electrons to say...
>
>> Your following code does always return the "timeout". What's wrong with
>> it?
>
> Michael - I've updated this code a bit. If you're only using HTTP, it's
> best
> to go directly to the protocol handler, as you'll have more control that
> way.
>
> Take a look at the RSS module. You'll probably want 'create' => 0,
>
> Let me know if this is still giving you headaches.

It's rather the slow responses from allmusic that give headaches. If I set
args{'timeout'} = 30 it will sometimes still time out _and_ block the
stream. Is this only non blocking, if the timeout is set low enough?

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

mherger
2005-02-25, 08:43
Dan

Is there a way to upload files in a request (to feed an external form)
using your non blocking stuff? I tried adding some headers to the post
parameter - without success :-(.


> * Michael Herger shaped the electrons to say...
>
>> Your following code does always return the "timeout". What's wrong with
>> it?
>
> Michael - I've updated this code a bit. If you're only using HTTP, it's
> best
> to go directly to the protocol handler, as you'll have more control that
> way.
>
> Take a look at the RSS module. You'll probably want 'create' => 0,
>
> Let me know if this is still giving you headaches.
>
> -D



--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

Dan Sully
2005-02-25, 11:21
* Michael Herger shaped the electrons to say...

>Is there a way to upload files in a request (to feed an external form)
>using your non blocking stuff? I tried adding some headers to the post
>parameter - without success :-(.

What headers do you need?

-D
--
I'm really looking forward to this hangover.

mherger
2005-02-25, 14:56
On Fri, 25 Feb 2005 10:21:40 -0800, Dan Sully <dan (AT) slimdevices (DOT) com> wrote:

> * Michael Herger shaped the electrons to say...
>
>> Is there a way to upload files in a request (to feed an external form)
>> using your non blocking stuff? I tried adding some headers to the post
>> parameter - without success :-(.
>
> What headers do you need?

If only I knew what I need (I thought about content types)... Meanwhile I
changed to url encoding the file and it seems to work for me (but not
NÚstor). I'll do some more tests.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)