cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl hangs in select() function when accessing a lot of URLs

From: Vince Tagle <vtagle_at_newsguy.com>
Date: Thu, 11 Jan 2007 17:08:52 -0800

On Jan 11, 2007, Daniel Stenberg wrote:

> On Wed, 10 Jan 2007, Vince Tagle wrote:
>
>> Actually, upon closer inspection, I think some of the websites are
>> handing
>> back bogus data or something. The one that I was getting stuck on
>> in one
>> instance turned out to be a redirect that was redirecting to the
>> same URL.
>
> But then it doesn't hang in select()!? And besides, libcurl has a
> max on
> number of redirects that it follows so it should stop after that
> amount
> (default is 50 iirc).

According to the description of CURLOPT_MAXREDIRS at http://
curl.haxx.se/libcurl/c/curl_easy_setopt.html:

Set it to -1 for an infinite number of redirects (which is the default)

Once I set it to a more sane value (like 5), libcurl stopped getting
stuck on a lot of problem websites.

So to recap, libcurl was stuck in an infinite loop because of a
website redirecting it to the same URL over and over. When I stopped
it in the debugger, it was stuck in select() so I thought maybe I had
tried to open too many websites in sequence. Setting
CURLOPT_MAXREDIRS to something not -1 fixed it.
Received on 2007-01-12