cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-users Mailing List Archives

wishlist: curl_easy_setopt(3): add better bad input warning?

From: Andreas Mohr <andi_at_lisas.de>
Date: Mon, 3 Mar 2008 14:45:15 +0100

Hi all,

doing something as simple as

VERIFY(curl_easy_setopt(curl_handle, CURLOPT_VERBOSE) == CURLE_OK)

can have dire consequences since it is missing the additional parameter
(boolean, verbosity on/off) that seems to be required for all
curl_easy_setopt() invocations. This results in loud complaints by
Valgrind (stack trashing etc.).

The curl_easy_setopt(3) man page
(http://curl.haxx.se/libcurl/c/curl_easy_setopt.html)
does mention to take care about invocation, but I think it could be
even a bit more obvious about that.
Currently it's written as:

curl_easy_setopt() is used to tell libcurl how to behave. By using the
appropriate options to curl_easy_setopt, you can change libcurl's
behavior. All options are set with the option followed by a parameter.
That parameter can be a long, a function pointer, an object pointer or a
curl_off_t, depending on what the specific option expects. Read this
manual carefully as bad input values may cause libcurl to behave badly!

Which should perhaps be modified to contain (changes underscored):

curl_easy_setopt() is used to tell libcurl how to behave. By using the
appropriate options to curl_easy_setopt, you can change libcurl's
behavior. All options are set with the option followed by a parameter.
That parameter can be a long, a function pointer, an object pointer or a
curl_off_t, depending on what the specific option expects. Read this
manual carefully as _bad/missing/superfluous_ input values
_to this variable argument count function may cause your entire program_
to behave badly!

Food for thought, perhaps?

Thanks a lot for a _very_ useful library!
(soooo much more stable and powerful than widely used alternatives,
it's not even funny! Helped me tremendously in getting net transfers
just right)

Andreas Mohr
Received on 2008-03-03

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET