Package: libcurl3-dev
Version: 7.14.0-5
Severity: normal

I started rewritting a small web client using CURL, and for each
curl_* function, I had:

        int errnum;
        errnum=cur_*();
        if (CURLE_OK!=errnum) {
                fprintf(stderr, "%d: %s\n", __LINE__,
                                curl_easy_strerror(errnum));
                exit(EXIT_FAILURE);
        }

I read about CURLOPT_ERRORBUFFER, and it seemed to me that it would
simplify that repeated code a bit.  So I added, immedately after
creating an easyhandle (involving an error check, as above):

        char errbuf[CURL_ERROR_SIZE];
        errnum=curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errbuf);
        if (CURLE_OK!=errnum) {
                fprintf(stderr, "%d: %s\n", __LINE__,
                                curl_easy_strerror(errnum));
                exit(EXIT_FAILURE);
        }

and then I deliberately didn't set a URL, and then called:

        errnum=curl_easy_perform(handle);
        if (CURLE_OK!=errnum) {
                fprintf(stderr, "%d: %s\n", __LINE__, errbuf);
                exit(EXIT_FAILURE);
        }

(This time without the call to curl_easy_strerror()).  But, I got
garbage string output, so apparently I have no clue how this works.
Does it just specify a different buffer, instead of a buffer to be
mallocated by curl?  Could you improve the documentation?  Maybe
include an example?


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to