cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: interruptible curl_easy_perform()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 21 Feb 2007 14:11:16 +0100 (CET)

On Wed, 21 Feb 2007, Bryan Henderson wrote:

>> When using select() we have no way to know properly when too many sockets
>> are being used and thus buffer-overwriting.

> I'm not familiar with that problem; can you elaborate?

An application uses N file handles, where N presumably is a very large number.
It then creates a libcurl easy handle and starts using it. libcurl creates
sockets to use.

When using the select() concept, FD_SET() is used to set a bit in a *fixed
size* array (in most implementations at least). The fixed size is set at
build-time and systems (normally) don't check if the file descriptor passed to
FD_SET() is within the boundary or not. And it isn't easy for us to check that
either without knowing about internals like how the file descriptor numbers
are generated and how the FD_SET() macro/function is written.

So, when N above approaches FS_SETSIZE, libcurl starts overwriting the fd_set
buffers.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-02-21